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/11/26 01:57:49 UTC
svn commit: r720690 - in /tapestry/tapestry5/trunk/tapestry-ioc/src:
main/java/org/apache/tapestry5/ioc/internal/ site/apt/
test/java/org/apache/tapestry5/ioc/internal/
Author: hlship
Date: Tue Nov 25 16:57:49 2008
New Revision: 720690
URL: http://svn.apache.org/viewvc?rev=720690&view=rev
Log:
TAP5-371: Service contribution methods should be able to inlcude a parameter of type Logger (the service's logger), so as to give contributions the option to log with the service
Modified:
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ContributionDefImpl.java
tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/configuration.apt
tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/injection.apt
tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ContributionDefImplTest.java
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ContributionDefImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ContributionDefImpl.java?rev=720690&r1=720689&r2=720690&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ContributionDefImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/ContributionDefImpl.java Tue Nov 25 16:57:49 2008
@@ -25,6 +25,7 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Map;
+import java.util.logging.Logger;
public class ContributionDefImpl implements ContributionDef
{
@@ -75,12 +76,9 @@
{
Map<Class, Object> resourceMap = CollectionFactory.newMap();
- // The way it works is: the method will take Configuration, OrderedConfiguration or
- // MappedConfiguration. So, if the method is for one type and the service is for a different
- // type, then we'll see an error putting together the parameter.
-
resourceMap.put(parameterType, parameterValue);
resourceMap.put(ObjectLocator.class, resources);
+ resourceMap.put(Logger.class, resources.getLogger());
InjectionResources injectionResources = new MapInjectionResources(resourceMap);
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/configuration.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/configuration.apt?rev=720690&r1=720689&r2=720690&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/configuration.apt (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/configuration.apt Tue Nov 25 16:57:49 2008
@@ -243,6 +243,8 @@
* {{{apidocs/org/apache/tapestry5/ioc/ObjectLocator.html}ObjectLocator}}: access to other services visible
to the contributing module
+
+ * org.slf4j.Logger: the Logger for the service being contributed to
[]
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/injection.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/injection.apt?rev=720690&r1=720689&r2=720690&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/injection.apt (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/injection.apt Tue Nov 25 16:57:49 2008
@@ -81,8 +81,12 @@
* Autobuilt object: no special resources
- * Contributor method: The appropriate Configuration, OrderedConfiguration or MappedConfiguration instance.
+ * Contributor method:
+ * The appropriate Configuration, OrderedConfiguration or MappedConfiguration instance.
+
+ * org.slf4j.Logger: Logger for the service, based on the class name of the module and the service id
+
* Service builder method:
* String: the service id
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ContributionDefImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ContributionDefImplTest.java?rev=720690&r1=720689&r2=720690&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ContributionDefImplTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ContributionDefImplTest.java Tue Nov 25 16:57:49 2008
@@ -20,6 +20,7 @@
import org.apache.tapestry5.ioc.test.IOCTestCase;
import static org.easymock.EasyMock.eq;
import static org.easymock.EasyMock.isA;
+import org.slf4j.Logger;
import org.testng.annotations.Test;
import java.lang.reflect.Method;
@@ -42,6 +43,9 @@
toContribute = new Object();
Configuration configuration = mockConfiguration();
ServiceResources serviceResources = mockServiceResources(tracker);
+ Logger logger = mockLogger();
+
+ train_getLogger(serviceResources, logger);
configuration.add(toContribute);
@@ -62,7 +66,9 @@
Configuration configuration = mockConfiguration();
ServiceResources resources = mockServiceResources(tracker);
UpcaseService service = mockUpcaseService();
+ Logger logger = mockLogger();
+ train_getLogger(resources, logger);
train_getService(resources, "zip.Zap", UpcaseService.class, service);
configuration.add(service);
@@ -82,6 +88,9 @@
{
Configuration configuration = mockConfiguration();
ServiceResources resources = mockServiceResources(tracker);
+ Logger logger = mockLogger();
+
+ train_getLogger(resources, logger);
Throwable t = new RuntimeException("Missing service.");
@@ -118,6 +127,9 @@
OrderedConfiguration configuration = mockOrderedConfiguration();
ServiceResources resources = mockServiceResources(tracker);
UpcaseService service = mockUpcaseService();
+ Logger logger = mockLogger();
+
+ train_getLogger(resources, logger);
train_getService(resources, "zip.Zap", UpcaseService.class, service);
@@ -140,6 +152,9 @@
MappedConfiguration configuration = mockMappedConfiguration();
ServiceResources resources = mockServiceResources(tracker);
UpcaseService service = mockUpcaseService();
+ Logger logger = mockLogger();
+
+ train_getLogger(resources, logger);
train_getService(resources, "zip.Zap", UpcaseService.class, service);