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 2010/03/17 04:03:11 UTC

svn commit: r924118 - in /tapestry/tapestry5/trunk/tapestry-core/src: main/java/org/apache/tapestry5/internal/services/ main/java/org/apache/tapestry5/services/ test/app1/ test/java/org/apache/tapestry5/integration/app1/ test/java/org/apache/tapestry5/...

Author: hlship
Date: Wed Mar 17 03:03:10 2010
New Revision: 924118

URL: http://svn.apache.org/viewvc?rev=924118&view=rev
Log:
TAP5-1056: The application global message catalog should be injectable into services

Added:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ApplicationMessageCatalogObjectProvider.java   (with props)
    tapestry/tapestry5/trunk/tapestry-core/src/test/app1/InjectMessagesDemo.tml
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/InjectMessagesDemo.java   (with props)
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/MessageAccess.java   (with props)
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/MessageAccessImpl.java   (with props)
Removed:
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/DefaultInjectionProviderTest.java
Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentMessagesSource.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentMessagesSourceImpl.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DefaultInjectionProvider.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/AppModule.java

Added: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ApplicationMessageCatalogObjectProvider.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ApplicationMessageCatalogObjectProvider.java?rev=924118&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ApplicationMessageCatalogObjectProvider.java (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ApplicationMessageCatalogObjectProvider.java Wed Mar 17 03:03:10 2010
@@ -0,0 +1,114 @@
+// Copyright 2010 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.tapestry5.internal.services;
+
+import java.util.Locale;
+import java.util.Map;
+
+import org.apache.tapestry5.ioc.AnnotationProvider;
+import org.apache.tapestry5.ioc.Messages;
+import org.apache.tapestry5.ioc.ObjectCreator;
+import org.apache.tapestry5.ioc.ObjectLocator;
+import org.apache.tapestry5.ioc.ObjectProvider;
+import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
+import org.apache.tapestry5.ioc.services.ClassFactory;
+import org.apache.tapestry5.ioc.services.ThreadLocale;
+import org.apache.tapestry5.services.InvalidationListener;
+
+/**
+ * Allows for injection of the global application message catalog into services. The injected value
+ * is, in fact, a proxy. Each method access of the proxy will determine the current thread's locale, and delegate
+ * to the actual global message catalog for that particular locale. There's caching to keep it reasonably
+ * efficient.
+ * 
+ * @since 5.2.0
+ * @see ComponentMessagesSource#getApplicationCatalog(Locale)
+ */
+public class ApplicationMessageCatalogObjectProvider implements ObjectProvider, InvalidationListener
+{
+    private final ObjectLocator objectLocator;
+
+    private ComponentMessagesSource messagesSource;
+
+    private ThreadLocale threadLocale;
+
+    private final Map<Locale, Messages> localeToMessages = CollectionFactory.newMap();
+
+    private Messages proxy;
+
+    private class ApplicationMessagesObjectCreator implements ObjectCreator
+    {
+        public Object createObject()
+        {
+            Locale locale = threadLocale.getLocale();
+
+            Messages messages = localeToMessages.get(locale);
+
+            if (messages == null)
+            {
+                messages = messagesSource.getApplicationCatalog(locale);
+                localeToMessages.put(locale, messages);
+            }
+
+            return messages;
+        }
+    };
+
+    public ApplicationMessageCatalogObjectProvider(ObjectLocator locator)
+    {
+        this.objectLocator = locator;
+    }
+
+    /**
+     * Because this is an ObjectProvider and is part of the MasterObjectProvider pipeline, it has to
+     * be careful to not require further dependencies at construction time. This means we have to "drop out"
+     * of normal IoC dependency injection and adopt a lookup strategy based on the ObjectLocator. Further,
+     * we have to be careful about multi-threading issues.
+     */
+    private synchronized Messages getProxy()
+    {
+        if (proxy == null)
+        {
+            this.messagesSource = objectLocator.getService(ComponentMessagesSource.class);
+            this.threadLocale = objectLocator.getService(ThreadLocale.class);
+
+            ClassFactory classFactory = objectLocator.getService("ClassFactory", ClassFactory.class);
+
+            proxy = classFactory.createProxy(Messages.class, new ApplicationMessagesObjectCreator(),
+                    "<ApplicationMessagesProxy>");
+
+            // Listen for invalidations; clear our cache of localized Messages bundles when
+            // and invalidation occurs.
+
+            messagesSource.getInvalidationEventHub().addInvalidationListener(this);
+        }
+
+        return proxy;
+    }
+
+    public <T> T provide(Class<T> objectType, AnnotationProvider annotationProvider, ObjectLocator locator)
+    {
+        if (objectType.equals(Messages.class))
+            return objectType.cast(getProxy());
+
+        return null;
+    }
+
+    public void objectWasInvalidated()
+    {
+        localeToMessages.clear();
+    }
+
+}

Propchange: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ApplicationMessageCatalogObjectProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentMessagesSource.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentMessagesSource.java?rev=924118&r1=924117&r2=924118&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentMessagesSource.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentMessagesSource.java Wed Mar 17 03:03:10 2010
@@ -4,7 +4,7 @@
 // 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
+// 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,
@@ -14,13 +14,13 @@
 
 package org.apache.tapestry5.internal.services;
 
+import java.util.Locale;
+
 import org.apache.tapestry5.ioc.Messages;
 import org.apache.tapestry5.ioc.annotations.NotLazy;
 import org.apache.tapestry5.model.ComponentModel;
 import org.apache.tapestry5.services.InvalidationEventHub;
 
-import java.util.Locale;
-
 /**
  * Used to connect a Tapestry component to its message catalog.
  */
@@ -30,7 +30,7 @@ public interface ComponentMessagesSource
      * Used to obtain a {@link Messages} instance for a particular component, within a particular locale. If the
      * component extends from another component, then its localized properties will merge with its parent's properties
      * (with the subclass overriding the super class on any conflicts).
-     *
+     * 
      * @param componentModel
      * @param locale
      * @return the message catalog for the component, in the indicated locale
@@ -38,8 +38,15 @@ public interface ComponentMessagesSource
     Messages getMessages(ComponentModel componentModel, Locale locale);
 
     /**
+     * Gets the Messages derived from the application's message catalog.
+     * 
+     * @since 5.2.0
+     */
+    Messages getApplicationCatalog(Locale locale);
+
+    /**
      * Returns the event hub that allows listeners to be notified when any underlying message catalog file is changed.
-     *
+     * 
      * @since 5.1.0.0
      */
     @NotLazy

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentMessagesSourceImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentMessagesSourceImpl.java?rev=924118&r1=924117&r2=924118&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentMessagesSourceImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentMessagesSourceImpl.java Wed Mar 17 03:03:10 2010
@@ -14,6 +14,8 @@
 
 package org.apache.tapestry5.internal.services;
 
+import java.util.Locale;
+
 import org.apache.tapestry5.SymbolConstants;
 import org.apache.tapestry5.internal.util.URLChangeTracker;
 import org.apache.tapestry5.ioc.Messages;
@@ -25,24 +27,21 @@ import org.apache.tapestry5.services.Inv
 import org.apache.tapestry5.services.UpdateListener;
 import org.apache.tapestry5.services.messages.PropertiesFileParser;
 
-import java.util.Locale;
-
 public class ComponentMessagesSourceImpl implements ComponentMessagesSource, UpdateListener
 {
     private final MessagesSource messagesSource;
 
     private final Resource appCatalogResource;
 
-    private static class ComponentModelBundle implements MessagesBundle
+    private final MessagesBundle appCatalogBundle;
+
+    private class ComponentModelBundle implements MessagesBundle
     {
         private final ComponentModel model;
 
-        private final MessagesBundle rootBundle;
-
-        public ComponentModelBundle(ComponentModel model, MessagesBundle rootBundle)
+        public ComponentModelBundle(ComponentModel model)
         {
             this.model = model;
-            this.rootBundle = rootBundle;
         }
 
         public Resource getBaseResource()
@@ -60,9 +59,9 @@ public class ComponentMessagesSourceImpl
             ComponentModel parentModel = model.getParentModel();
 
             if (parentModel == null)
-                return rootBundle;
+                return appCatalogBundle;
 
-            return new ComponentModelBundle(parentModel, rootBundle);
+            return new ComponentModelBundle(parentModel);
         }
     }
 
@@ -81,6 +80,8 @@ public class ComponentMessagesSourceImpl
         this.appCatalogResource = appCatalogResource;
 
         messagesSource = new MessagesSourceImpl(tracker, parser);
+
+        appCatalogBundle = createAppCatalogBundle();
     }
 
     public void checkForUpdates()
@@ -90,16 +91,17 @@ public class ComponentMessagesSourceImpl
 
     public Messages getMessages(ComponentModel componentModel, Locale locale)
     {
-        // If the application catalog exists, set it up as the root, otherwise use null.
-
-        MessagesBundle appCatalogBundle = !appCatalogResource.exists() ? null : rootBundle();
-
-        MessagesBundle bundle = new ComponentModelBundle(componentModel, appCatalogBundle);
+        MessagesBundle bundle = new ComponentModelBundle(componentModel);
 
         return messagesSource.getMessages(bundle, locale);
     }
 
-    private MessagesBundle rootBundle()
+    public Messages getApplicationCatalog(Locale locale)
+    {
+        return messagesSource.getMessages(appCatalogBundle, locale);
+    }
+
+    private MessagesBundle createAppCatalogBundle()
     {
         return new MessagesBundle()
         {

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DefaultInjectionProvider.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DefaultInjectionProvider.java?rev=924118&r1=924117&r2=924118&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DefaultInjectionProvider.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DefaultInjectionProvider.java Wed Mar 17 03:03:10 2010
@@ -1,10 +1,10 @@
-// Copyright 2006, 2007 The Apache Software Foundation
+// Copyright 2006, 2007, 2010 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
+// 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,
@@ -14,21 +14,20 @@
 
 package org.apache.tapestry5.internal.services;
 
-import org.apache.tapestry5.ioc.AnnotationProvider;
+import org.apache.tapestry5.ioc.Messages;
 import org.apache.tapestry5.ioc.ObjectLocator;
 import org.apache.tapestry5.ioc.services.MasterObjectProvider;
 import org.apache.tapestry5.model.MutableComponentModel;
 import org.apache.tapestry5.services.ClassTransformation;
 import org.apache.tapestry5.services.InjectionProvider;
-
-import java.lang.annotation.Annotation;
+import org.apache.tapestry5.services.TransformField;
 
 /**
- * Worker for the {@link org.apache.tapestry5.ioc.annotations.Inject} annotation that delegates out to the master {@link
- * org.apache.tapestry5.ioc.services.MasterObjectProvider} to access the value. This worker must be scheduled after
- * certain other workers, such as {@link BlockInjectionProvider} (which is keyed off a combination of type and the
- * Inject annotation).
- *
+ * Worker for the {@link org.apache.tapestry5.ioc.annotations.Inject} annotation that delegates out to the master
+ * {@link org.apache.tapestry5.ioc.services.MasterObjectProvider} to access the value. This worker must be scheduled
+ * after certain other workers, such as {@link BlockInjectionProvider} (which is keyed off a combination of type and
+ * the Inject annotation).
+ * 
  * @see org.apache.tapestry5.ioc.services.MasterObjectProvider
  */
 public class DefaultInjectionProvider implements InjectionProvider
@@ -44,26 +43,29 @@ public class DefaultInjectionProvider im
     }
 
     @SuppressWarnings("unchecked")
-    public boolean provideInjection(final String fieldName, Class fieldType, ObjectLocator locator,
-                                    final ClassTransformation transformation, MutableComponentModel componentModel)
+    public boolean provideInjection(String fieldName, Class fieldType, ObjectLocator locator,
+            final ClassTransformation transformation, MutableComponentModel componentModel)
     {
-        AnnotationProvider annotationProvider = new AnnotationProvider()
-        {
-            public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
-            {
-                return transformation.getFieldAnnotation(fieldName, annotationClass);
-            }
-        };
+        // I hate special cases, but we have a conflict between the ObjectProvider contributed so as to inject
+        // the global application messages into services, and the injection of per-component Messages into components.
+        // For yet other reasons, this InjectionProvider gets invoked before CommonResources, and will attempt
+        // to inject the wrong Messages (the global application messages, not the component messages) ... so we
+        // make a special check here.
+
+        if (fieldType.equals(Messages.class))
+            return false;
+
+        TransformField field = transformation.getField(fieldName);
 
-        Object inject = masterObjectProvider.provide(fieldType, annotationProvider, this.locator, false);
+        Object injectionValue = masterObjectProvider.provide(fieldType, field, this.locator, false);
 
         // Null means that no ObjectProvider could provide the value. We have set up the chain of
         // command so that InjectResources can give it a try next. Later, we'll try to match against
         // a service.
 
-        if (inject != null)
+        if (injectionValue != null)
         {
-            transformation.injectField(fieldName, inject);
+            field.inject(injectionValue);
             return true;
         }
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java?rev=924118&r1=924117&r2=924118&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java Wed Mar 17 03:03:10 2010
@@ -789,6 +789,8 @@ public final class TapestryModule
      * <dd>Checks for the {@link Path} annotation, and injects an {@link Asset}</dd>
      * <dt>Service</dt>
      * <dd>Injects based on the {@link Service} annotation, if present</dd>
+     * <dt>ApplicationMessages</dt>
+     * <dd>Injects the global application messages</dd>
      * </dl>
      */
     public static void contributeMasterObjectProvider(OrderedConfiguration<ObjectProvider> configuration,
@@ -797,19 +799,16 @@ public final class TapestryModule
     final Alias alias,
 
     @InjectService("AssetObjectProvider")
-    ObjectProvider assetObjectProvider)
+    ObjectProvider assetObjectProvider,
+
+    ObjectLocator locator)
     {
         // There's a nasty web of dependencies related to Alias; this wrapper
-        // class lets us
-        // defer instantiating the Alias service implementation just long enough
-        // to defuse those
-        // dependencies. The @Local annotation prevents a recursive call through
-        // the
-        // MasterObjectProvider to resolve the Alias service itself; that is
-        // MasterObjectProvider
-        // gets built using this proxy, then the proxy will trigger the
-        // construction of AliasImpl
-        // (which itself needs MasterObjectProvider to resolve some
+        // class lets us defer instantiating the Alias service implementation just long enough
+        // to defuse those dependencies. The @Local annotation prevents a recursive call through
+        // the MasterObjectProvider to resolve the Alias service itself; that is
+        // MasterObjectProvider gets built using this proxy, then the proxy will trigger the
+        // construction of AliasImpl (which itself needs MasterObjectProvider to resolve some
         // dependencies).
 
         ObjectProvider wrapper = new ObjectProvider()
@@ -825,6 +824,10 @@ public final class TapestryModule
         configuration.add("Asset", assetObjectProvider, "before:AnnotationBasedContributions");
 
         configuration.add("Service", new ServiceAnnotationObjectProvider(), "before:AnnotationBasedContributions");
+
+        configuration.add("ApplicationMessages", new ApplicationMessageCatalogObjectProvider(locator),
+                "before:AnnotationBasedContributions");
+
     }
 
     /**

Added: tapestry/tapestry5/trunk/tapestry-core/src/test/app1/InjectMessagesDemo.tml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/app1/InjectMessagesDemo.tml?rev=924118&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/app1/InjectMessagesDemo.tml (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/app1/InjectMessagesDemo.tml Wed Mar 17 03:03:10 2010
@@ -0,0 +1,11 @@
+<html t:type="Border" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
+
+  <h1>Inject Application Messages Demo</h1>
+
+  <p>
+    Status (from message catalog is):
+    <strong id="status">${access.statusMessage}</strong>
+  </p>
+
+</html>
+

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java?rev=924118&r1=924117&r2=924118&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java Wed Mar 17 03:03:10 2010
@@ -1441,4 +1441,13 @@ public class CoreBehaviorsTests extends 
                 "Method org.apache.tapestry5.integration.app1.pages.PageResetFailure.reset(java.lang.String)",
                 "is invalid: methods with the @PageReset annotation must return void, and have no parameters.");
     }
+
+    /** TAP5-1056 */
+    @Test
+    public void injection_of_application_message_catalog_into_service()
+    {
+        clickThru("Inject Global Messages into Service Demo");
+
+        assertText("status", "Application Catalog Working");
+    }
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java?rev=924118&r1=924117&r2=924118&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java Wed Mar 17 03:03:10 2010
@@ -67,9 +67,12 @@ public class Index
     private static final List<Item> ITEMS = CollectionFactory
             .newList(
 
+                    new Item("InjectMessagesDemo", "Inject Global Messages into Service Demo",
+                            "Ensure that it is possible to inject the application global message catalog into a service"),
+
                     new Item("ReloadDemo", "Reloadable Service Implementation Demo",
                             "Used when manually testing service reloads"),
-                    
+
                     new Item("QueryParameterDemo", "QueryParameter Annotation Demo",
                             "Use of @QueryParameter annotation on event handler method parameters"),
 

Added: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/InjectMessagesDemo.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/InjectMessagesDemo.java?rev=924118&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/InjectMessagesDemo.java (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/InjectMessagesDemo.java Wed Mar 17 03:03:10 2010
@@ -0,0 +1,26 @@
+// Copyright 2010 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.tapestry5.integration.app1.pages;
+
+import org.apache.tapestry5.annotations.Property;
+import org.apache.tapestry5.integration.app1.services.MessageAccess;
+import org.apache.tapestry5.ioc.annotations.Inject;
+
+public class InjectMessagesDemo
+{
+    @Property
+    @Inject
+    private MessageAccess access;
+}

Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/InjectMessagesDemo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/AppModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/AppModule.java?rev=924118&r1=924117&r2=924118&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/AppModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/AppModule.java Wed Mar 17 03:03:10 2010
@@ -62,6 +62,7 @@ public class AppModule
     public static void bind(ServiceBinder binder)
     {
         binder.bind(Reloadable.class);
+        binder.bind(MessageAccess.class);
     }
 
     public void contributeAlias(Configuration<AliasContribution> configuration)

Added: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/MessageAccess.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/MessageAccess.java?rev=924118&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/MessageAccess.java (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/MessageAccess.java Wed Mar 17 03:03:10 2010
@@ -0,0 +1,20 @@
+// Copyright 2010 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.tapestry5.integration.app1.services;
+
+public interface MessageAccess
+{
+    String getStatusMessage();
+}

Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/MessageAccess.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/MessageAccessImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/MessageAccessImpl.java?rev=924118&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/MessageAccessImpl.java (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/MessageAccessImpl.java Wed Mar 17 03:03:10 2010
@@ -0,0 +1,30 @@
+// Copyright 2010 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.tapestry5.integration.app1.services;
+
+import org.apache.tapestry5.ioc.Messages;
+import org.apache.tapestry5.ioc.annotations.Inject;
+
+public class MessageAccessImpl implements MessageAccess
+{
+    @Inject
+    private Messages messages;
+
+    public String getStatusMessage()
+    {
+        return messages.get("app-catalog-status");
+    }
+
+}

Propchange: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/MessageAccessImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native