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/05/26 00:35:04 UTC
svn commit: r948226 - in /tapestry/tapestry5/trunk: src/site/apt/
tapestry-annotations/src/main/java/org/apache/tapestry5/ioc/annotations/
tapestry-core/src/main/java/org/apache/tapestry5/internal/services/
tapestry-core/src/main/java/org/apache/tapest...
Author: hlship
Date: Tue May 25 22:35:03 2010
New Revision: 948226
URL: http://svn.apache.org/viewvc?rev=948226&view=rev
Log:
TAP5-1170: Remove automatic injection of service id into parameters of type String
Modified:
tapestry/tapestry5/trunk/src/site/apt/upgrade.apt
tapestry/tapestry5/trunk/tapestry-annotations/src/main/java/org/apache/tapestry5/ioc/annotations/Inject.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ApplicationStackTraceElementAnalyzer.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AssetDispatcher.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentClassResolverImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DefaultRequestExceptionHandler.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/JSONArrayEventResultProcessor.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/JSONObjectEventResultProcessor.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/LocalizationSetterImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PageContentTypeAnalyzerImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PersistentLocaleImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/RootPathDispatcher.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/assets/AssetPathConstructorImpl.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/services/AppModule.java
tapestry/tapestry5/trunk/tapestry-hibernate/src/main/java/org/apache/tapestry5/hibernate/HibernateModule.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/AbstractMethodInvokingInstrumenter.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/AbstractServiceCreator.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/SymbolSource.java
tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/injection.apt
tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/CyclicMOPModule.java
tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/FieldResourceServiceImpl.java
tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/ServiceIdGreeter.java
tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ModuleImplTestModule.java
tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ServiceBuilderMethodFixture.java
tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ServiceBuilderMethodInvokerTest.java
tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry5/upload/internal/services/MultipartDecoderImpl.java
tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry5/upload/services/UploadModule.java
Modified: tapestry/tapestry5/trunk/src/site/apt/upgrade.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/src/site/apt/upgrade.apt?rev=948226&r1=948225&r2=948226&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/src/site/apt/upgrade.apt (original)
+++ tapestry/tapestry5/trunk/src/site/apt/upgrade.apt Tue May 25 22:35:03 2010
@@ -14,6 +14,17 @@ Upgrade Notes
Release 5.2.0
+* Service Id Injection
+
+ In prior releases of Tapestry, a constructor parameter of type String was assumed to be the service id.
+ In the many cases where these was not the case (such as using the @Value or @Symbol annotation), the parameter
+ needed to be annotated with the @Inject annotation.
+
+ Starting in 5.2, this feature is no longer present (this is a <non-backwards compatible change>, but one that
+ affects virtually nobody). A parameter of type String will be subject to normal
+ injection; you will likely want to use @Value or @Symbol with it, or you will see an error that "No service
+ implements java.lang.String.".
+
* TranslatorSource
The configuration type for TranslatorSource has changed in an <<incompatible>> way: from
Modified: tapestry/tapestry5/trunk/tapestry-annotations/src/main/java/org/apache/tapestry5/ioc/annotations/Inject.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-annotations/src/main/java/org/apache/tapestry5/ioc/annotations/Inject.java?rev=948226&r1=948225&r2=948226&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-annotations/src/main/java/org/apache/tapestry5/ioc/annotations/Inject.java (original)
+++ tapestry/tapestry5/trunk/tapestry-annotations/src/main/java/org/apache/tapestry5/ioc/annotations/Inject.java Tue May 25 22:35:03 2010
@@ -1,10 +1,10 @@
-// Copyright 2006, 2007, 2008, 2009 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 2009, 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,
@@ -26,18 +26,18 @@ import static org.apache.tapestry5.ioc.a
* This annotation serves is something of the Swiss Army knife for operations related to injection of dependencies into
* an arbitrary method of Java Bean.
* <p/>
- * <p>It marks parameters that should be injected in the IoC container, and it marks fields that should be injected
- * inside Tapestry components.
+ * <p>
+ * It marks parameters that should be injected in the IoC container, and it marks fields that should be injected inside
+ * Tapestry components.
* <p/>
* In terms of the IoC container; normally, resources take precedence over annotations when injecting. The Inject
- * annotation overrides this default, forcing the resolution of the parameters value via the master {@link
- * org.apache.tapestry5.ioc.ObjectProvider}, even when the parameter's type matches a type that is normally a resource.
- * This is most often used in conjunction with {@link org.apache.tapestry5.ioc.annotations.Value} annotation when
- * injecting a string, as normally, the String would be matched as the service id.
+ * annotation overrides this default, forcing the resolution of the parameters value via the master
+ * {@link org.apache.tapestry5.ioc.ObjectProvider}, even when the parameter's type matches a type that is normally a
+ * resource.
* <p/>
- * For service implementations, module classes, and other objects constructed via {@link
- * org.apache.tapestry5.ioc.ObjectLocator#autobuild(Class)}, this annotation indicates that an injection is desired on
- * the field, as with fields of a Tapestry component.
+ * For service implementations, module classes, and other objects constructed via
+ * {@link org.apache.tapestry5.ioc.ObjectLocator#autobuild(Class)}, this annotation indicates that an injection is
+ * desired on the field, as with fields of a Tapestry component.
* <p/>
* In terms of the IoC container, the Inject annotation is only used on parameters to service builder methods (and
* contributor and decorator methods) and on module class constructors. constructors. However, inside Tapestry
@@ -46,14 +46,15 @@ import static org.apache.tapestry5.ioc.a
* <p/>
* Finally, on a constructor, this is used to indicate <em>which</em> constructor should be used when more than one is
* available.
- *
+ *
* @see org.apache.tapestry5.ioc.ObjectProvider
*/
@Target(
- {PARAMETER, FIELD, CONSTRUCTOR})
+{ PARAMETER, FIELD, CONSTRUCTOR })
@Retention(RUNTIME)
@Documented
-@UseWith({COMPONENT,MIXIN,PAGE,SERVICE})
+@UseWith(
+{ COMPONENT, MIXIN, PAGE, SERVICE })
public @interface Inject
{
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ApplicationStackTraceElementAnalyzer.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ApplicationStackTraceElementAnalyzer.java?rev=948226&r1=948225&r2=948226&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ApplicationStackTraceElementAnalyzer.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ApplicationStackTraceElementAnalyzer.java Tue May 25 22:35:03 2010
@@ -1,10 +1,10 @@
-// Copyright 2009 The Apache Software Foundation
+// Copyright 2009, 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,
@@ -15,31 +15,28 @@
package org.apache.tapestry5.internal.services;
import org.apache.tapestry5.internal.InternalConstants;
-import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.ioc.annotations.Symbol;
import org.apache.tapestry5.services.StackTraceElementAnalyzer;
import org.apache.tapestry5.services.StackTraceElementClassConstants;
/**
* Identifies frames for application classes.
- *
+ *
* @since 5.1.0.0
*/
public class ApplicationStackTraceElementAnalyzer implements StackTraceElementAnalyzer
{
private final String appPackage;
- public ApplicationStackTraceElementAnalyzer(
- @Inject @Symbol(InternalConstants.TAPESTRY_APP_PACKAGE_PARAM)
- String appPackage)
+ public ApplicationStackTraceElementAnalyzer(@Symbol(InternalConstants.TAPESTRY_APP_PACKAGE_PARAM)
+ String appPackage)
{
this.appPackage = appPackage;
}
public String classForFrame(StackTraceElement frame)
{
- return frame.getClassName().startsWith(appPackage) && frame.getLineNumber() > 0
- ? StackTraceElementClassConstants.USER_CODE
- : null;
+ return frame.getClassName().startsWith(appPackage) && frame.getLineNumber() > 0 ? StackTraceElementClassConstants.USER_CODE
+ : null;
}
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AssetDispatcher.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AssetDispatcher.java?rev=948226&r1=948225&r2=948226&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AssetDispatcher.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AssetDispatcher.java Tue May 25 22:35:03 2010
@@ -1,4 +1,4 @@
-// Copyright 2006, 2008, 2009 The Apache Software Foundation
+// Copyright 2006, 2008, 2009, 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.
@@ -20,7 +20,6 @@ import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import org.apache.tapestry5.SymbolConstants;
-import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.ioc.annotations.Symbol;
import org.apache.tapestry5.ioc.annotations.UsesMappedConfiguration;
import org.apache.tapestry5.services.ClasspathAssetAliasManager;
@@ -47,7 +46,6 @@ public class AssetDispatcher implements
public AssetDispatcher(Map<String, AssetRequestHandler> configuration,
- @Inject
@Symbol(SymbolConstants.APPLICATION_VERSION)
String applicationVersion)
{
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentClassResolverImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentClassResolverImpl.java?rev=948226&r1=948225&r2=948226&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentClassResolverImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentClassResolverImpl.java Tue May 25 22:35:03 2010
@@ -14,10 +14,17 @@
package org.apache.tapestry5.internal.services;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Formatter;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.regex.Pattern;
+
import org.apache.tapestry5.SymbolConstants;
import org.apache.tapestry5.internal.InternalConstants;
import org.apache.tapestry5.ioc.Invokable;
-import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.ioc.annotations.Symbol;
import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
import org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier;
@@ -30,9 +37,6 @@ import org.apache.tapestry5.services.Inv
import org.apache.tapestry5.services.LibraryMapping;
import org.slf4j.Logger;
-import java.util.*;
-import java.util.regex.Pattern;
-
public class ComponentClassResolverImpl implements ComponentClassResolver, InvalidationListener
{
private static final String CORE_LIBRARY_PREFIX = "core/";
@@ -102,11 +106,9 @@ public class ComponentClassResolverImpl
ClassNameLocator classNameLocator,
- @Inject
@Symbol(InternalConstants.TAPESTRY_APP_PACKAGE_PARAM)
String appRootPackage,
- @Inject
@Symbol(SymbolConstants.START_PAGE_NAME)
String startPageName,
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DefaultRequestExceptionHandler.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DefaultRequestExceptionHandler.java?rev=948226&r1=948225&r2=948226&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DefaultRequestExceptionHandler.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DefaultRequestExceptionHandler.java Tue May 25 22:35:03 2010
@@ -1,4 +1,4 @@
-// Copyright 2006, 2008 The Apache Software Foundation
+// Copyright 2006, 2008, 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.
@@ -14,9 +14,12 @@
package org.apache.tapestry5.internal.services;
+import java.io.IOException;
+
+import javax.servlet.http.HttpServletResponse;
+
import org.apache.tapestry5.SymbolConstants;
import org.apache.tapestry5.internal.structure.Page;
-import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.ioc.annotations.Symbol;
import org.apache.tapestry5.ioc.internal.util.InternalUtils;
import org.apache.tapestry5.services.ExceptionReporter;
@@ -24,9 +27,6 @@ import org.apache.tapestry5.services.Req
import org.apache.tapestry5.services.Response;
import org.slf4j.Logger;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
/**
* Default implementation of {@link RequestExceptionHandler} that displays the standard ExceptionReport page. The page
* must implement the {@link ExceptionReporter} interface.
@@ -45,7 +45,7 @@ public class DefaultRequestExceptionHand
public DefaultRequestExceptionHandler(RequestPageCache pageCache, PageResponseRenderer renderer, Logger logger,
- @Inject @Symbol(SymbolConstants.EXCEPTION_REPORT_PAGE)
+ @Symbol(SymbolConstants.EXCEPTION_REPORT_PAGE)
String pageName,
Response response)
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/JSONArrayEventResultProcessor.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/JSONArrayEventResultProcessor.java?rev=948226&r1=948225&r2=948226&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/JSONArrayEventResultProcessor.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/JSONArrayEventResultProcessor.java Tue May 25 22:35:03 2010
@@ -1,10 +1,10 @@
-// Copyright 2008 The Apache Software Foundation
+// Copyright 2008, 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,18 +14,17 @@
package org.apache.tapestry5.internal.services;
+import java.io.IOException;
+import java.io.PrintWriter;
+
import org.apache.tapestry5.ContentType;
import org.apache.tapestry5.SymbolConstants;
import org.apache.tapestry5.internal.InternalConstants;
-import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.ioc.annotations.Symbol;
import org.apache.tapestry5.json.JSONArray;
import org.apache.tapestry5.services.ComponentEventResultProcessor;
import org.apache.tapestry5.services.Response;
-import java.io.IOException;
-import java.io.PrintWriter;
-
public class JSONArrayEventResultProcessor implements ComponentEventResultProcessor<JSONArray>
{
private final Response response;
@@ -33,8 +32,8 @@ public class JSONArrayEventResultProcess
public JSONArrayEventResultProcessor(Response response,
- @Inject @Symbol(SymbolConstants.CHARSET)
- String outputEncoding)
+ @Symbol(SymbolConstants.CHARSET)
+ String outputEncoding)
{
this.response = response;
this.outputEncoding = outputEncoding;
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/JSONObjectEventResultProcessor.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/JSONObjectEventResultProcessor.java?rev=948226&r1=948225&r2=948226&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/JSONObjectEventResultProcessor.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/JSONObjectEventResultProcessor.java Tue May 25 22:35:03 2010
@@ -1,10 +1,10 @@
-// Copyright 2007, 2008 The Apache Software Foundation
+// Copyright 2007, 2008, 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,19 +14,17 @@
package org.apache.tapestry5.internal.services;
+import java.io.IOException;
+import java.io.PrintWriter;
+
import org.apache.tapestry5.ContentType;
import org.apache.tapestry5.SymbolConstants;
import org.apache.tapestry5.internal.InternalConstants;
-import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.ioc.annotations.Symbol;
import org.apache.tapestry5.json.JSONObject;
import org.apache.tapestry5.services.ComponentEventResultProcessor;
import org.apache.tapestry5.services.Response;
-import java.io.IOException;
-import java.io.PrintWriter;
-
-
/**
* Implemention of {@link ComponentEventResultProcessor} for {@link org.apache.tapestry5.json.JSONObject}, allowing a
* component event handler to return a JSONObject that will be sent directly to the client as the reply. This is often
@@ -40,8 +38,8 @@ public class JSONObjectEventResultProces
public JSONObjectEventResultProcessor(Response response,
- @Inject @Symbol(SymbolConstants.CHARSET)
- String outputEncoding)
+ @Symbol(SymbolConstants.CHARSET)
+ String outputEncoding)
{
this.response = response;
this.outputEncoding = outputEncoding;
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/LocalizationSetterImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/LocalizationSetterImpl.java?rev=948226&r1=948225&r2=948226&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/LocalizationSetterImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/LocalizationSetterImpl.java Tue May 25 22:35:03 2010
@@ -25,7 +25,6 @@ import org.apache.tapestry5.SelectModel;
import org.apache.tapestry5.SymbolConstants;
import org.apache.tapestry5.internal.OptionModelImpl;
import org.apache.tapestry5.internal.SelectModelImpl;
-import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.ioc.annotations.Symbol;
import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
import org.apache.tapestry5.ioc.services.ThreadLocale;
@@ -59,7 +58,6 @@ public class LocalizationSetterImpl impl
ThreadLocale threadLocale,
- @Inject
@Symbol(SymbolConstants.SUPPORTED_LOCALES)
String supportedLocaleNames)
{
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PageContentTypeAnalyzerImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PageContentTypeAnalyzerImpl.java?rev=948226&r1=948225&r2=948226&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PageContentTypeAnalyzerImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PageContentTypeAnalyzerImpl.java Tue May 25 22:35:03 2010
@@ -1,10 +1,10 @@
-// Copyright 2007, 2008 The Apache Software Foundation
+// Copyright 2007, 2008, 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,
@@ -19,7 +19,6 @@ import org.apache.tapestry5.ContentType;
import org.apache.tapestry5.MetaDataConstants;
import org.apache.tapestry5.SymbolConstants;
import org.apache.tapestry5.internal.structure.Page;
-import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.ioc.annotations.Symbol;
import org.apache.tapestry5.services.MetaDataLocator;
@@ -31,8 +30,8 @@ public class PageContentTypeAnalyzerImpl
public PageContentTypeAnalyzerImpl(MetaDataLocator metaDataLocator,
- @Inject @Symbol(SymbolConstants.CHARSET)
- String outputCharset)
+ @Symbol(SymbolConstants.CHARSET)
+ String outputCharset)
{
this.metaDataLocator = metaDataLocator;
this.outputCharset = outputCharset;
@@ -43,7 +42,7 @@ public class PageContentTypeAnalyzerImpl
ComponentResources pageResources = page.getRootComponent().getComponentResources();
String contentTypeString = metaDataLocator.findMeta(MetaDataConstants.RESPONSE_CONTENT_TYPE, pageResources,
- String.class);
+ String.class);
// Draconian but necessary: overwrite the content type they selected with the application-wide output charset.
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PersistentLocaleImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PersistentLocaleImpl.java?rev=948226&r1=948225&r2=948226&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PersistentLocaleImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/PersistentLocaleImpl.java Tue May 25 22:35:03 2010
@@ -1,10 +1,10 @@
-// Copyright 2007, 2008, 2009 The Apache Software Foundation
+// Copyright 2007, 2008, 2009, 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,18 +14,17 @@
package org.apache.tapestry5.internal.services;
+import java.util.Locale;
+import java.util.Set;
+
import org.apache.tapestry5.SymbolConstants;
import org.apache.tapestry5.internal.TapestryInternalUtils;
-import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.ioc.annotations.Symbol;
import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
import org.apache.tapestry5.ioc.internal.util.Defense;
import org.apache.tapestry5.ioc.services.PerthreadManager;
import org.apache.tapestry5.services.PersistentLocale;
-import java.util.Locale;
-import java.util.Set;
-
public class PersistentLocaleImpl implements PersistentLocale
{
private final PerthreadManager perThreadManager;
@@ -36,8 +35,8 @@ public class PersistentLocaleImpl implem
public PersistentLocaleImpl(PerthreadManager perThreadManager,
- @Inject @Symbol(SymbolConstants.SUPPORTED_LOCALES)
- String supportedLocales)
+ @Symbol(SymbolConstants.SUPPORTED_LOCALES)
+ String supportedLocales)
{
this.perThreadManager = perThreadManager;
this.supportedLocales = supportedLocales;
@@ -54,14 +53,14 @@ public class PersistentLocaleImpl implem
if (!localeNames.contains(locale.toString().toLowerCase()))
{
- String message = String.format(
- "Locale '%s' is not supported by this application. Supported locales are '%s'; this is configured via the %s symbol.",
- locale, supportedLocales, SymbolConstants.SUPPORTED_LOCALES);
+ String message = String
+ .format(
+ "Locale '%s' is not supported by this application. Supported locales are '%s'; this is configured via the %s symbol.",
+ locale, supportedLocales, SymbolConstants.SUPPORTED_LOCALES);
throw new IllegalArgumentException(message);
}
-
perThreadManager.put(this, locale);
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/RootPathDispatcher.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/RootPathDispatcher.java?rev=948226&r1=948225&r2=948226&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/RootPathDispatcher.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/RootPathDispatcher.java Tue May 25 22:35:03 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,18 +14,22 @@
package org.apache.tapestry5.internal.services;
+import java.io.IOException;
+
import org.apache.tapestry5.EventContext;
import org.apache.tapestry5.SymbolConstants;
import org.apache.tapestry5.internal.EmptyEventContext;
-import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.ioc.annotations.Symbol;
-import org.apache.tapestry5.services.*;
-
-import java.io.IOException;
+import org.apache.tapestry5.services.ComponentClassResolver;
+import org.apache.tapestry5.services.ComponentRequestHandler;
+import org.apache.tapestry5.services.Dispatcher;
+import org.apache.tapestry5.services.PageRenderRequestParameters;
+import org.apache.tapestry5.services.Request;
+import org.apache.tapestry5.services.Response;
/**
* Recognizes a request for the application root (i.e., "/") and handles this the same as a render request for the
- * "Start" page. Support for the Start page is kept for legacy purposes, Index pages are the correct approach.
+ * "Start" page. Support for the Start page is kept for legacy purposes, Index pages are the correct approach.
*/
public class RootPathDispatcher implements Dispatcher
{
@@ -41,10 +45,10 @@ public class RootPathDispatcher implemen
public RootPathDispatcher(ComponentClassResolver componentClassResolver,
- ComponentRequestHandler handler,
+ ComponentRequestHandler handler,
- @Inject @Symbol(SymbolConstants.START_PAGE_NAME)
- String startPageName)
+ @Symbol(SymbolConstants.START_PAGE_NAME)
+ String startPageName)
{
this.componentClassResolver = componentClassResolver;
this.handler = handler;
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/assets/AssetPathConstructorImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/assets/AssetPathConstructorImpl.java?rev=948226&r1=948225&r2=948226&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/assets/AssetPathConstructorImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/assets/AssetPathConstructorImpl.java Tue May 25 22:35:03 2010
@@ -16,7 +16,6 @@ package org.apache.tapestry5.internal.se
import org.apache.tapestry5.SymbolConstants;
import org.apache.tapestry5.internal.services.RequestConstants;
-import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.ioc.annotations.Symbol;
import org.apache.tapestry5.services.Request;
import org.apache.tapestry5.services.assets.AssetPathConstructor;
@@ -29,7 +28,6 @@ public class AssetPathConstructorImpl im
public AssetPathConstructorImpl(Request request,
- @Inject
@Symbol(SymbolConstants.APPLICATION_VERSION)
String applicationVersion)
{
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=948226&r1=948225&r2=948226&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 Tue May 25 22:35:03 2010
@@ -392,7 +392,6 @@ public final class TapestryModule
@PreventServiceDecoration
public static Alias buildAlias(Logger logger,
- @Inject
@Symbol(InternalSymbols.ALIAS_MODE)
String mode,
@@ -939,7 +938,6 @@ public final class TapestryModule
*/
public void contributeRequestHandler(OrderedConfiguration<RequestFilter> configuration, Context context,
- // @Inject not needed because its a long, not a String
@Symbol(SymbolConstants.FILE_CHECK_INTERVAL)
@IntermediateType(TimeInterval.class)
long checkInterval,
@@ -1452,7 +1450,6 @@ public final class TapestryModule
@Primary
RequestHandler handler,
- @Inject
@Symbol(SymbolConstants.CHARSET)
String applicationCharset,
@@ -1930,7 +1927,6 @@ public final class TapestryModule
@Symbol(SymbolConstants.OMIT_GENERATOR_META)
final boolean omitGeneratorMeta,
- @Inject
@Symbol(SymbolConstants.TAPESTRY_VERSION)
final String tapestryVersion,
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=948226&r1=948225&r2=948226&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 Tue May 25 22:35:03 2010
@@ -36,7 +36,6 @@ import org.apache.tapestry5.ioc.MappedCo
import org.apache.tapestry5.ioc.OrderedConfiguration;
import org.apache.tapestry5.ioc.Resource;
import org.apache.tapestry5.ioc.ServiceBinder;
-import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.ioc.annotations.Marker;
import org.apache.tapestry5.ioc.annotations.Value;
import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
@@ -275,8 +274,7 @@ public class AppModule
configuration.add("ReverseStringsWorker", new ReverseStringsWorker());
}
- public static void contributeComponentMessagesSource(@Inject
- @Value("context:WEB-INF/pre-app.properties")
+ public static void contributeComponentMessagesSource(@Value("context:WEB-INF/pre-app.properties")
Resource preappResource, OrderedConfiguration<Resource> configuration)
{
configuration.add("PreApp", preappResource, "before:AppCatalog");
Modified: tapestry/tapestry5/trunk/tapestry-hibernate/src/main/java/org/apache/tapestry5/hibernate/HibernateModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-hibernate/src/main/java/org/apache/tapestry5/hibernate/HibernateModule.java?rev=948226&r1=948225&r2=948226&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-hibernate/src/main/java/org/apache/tapestry5/hibernate/HibernateModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-hibernate/src/main/java/org/apache/tapestry5/hibernate/HibernateModule.java Tue May 25 22:35:03 2010
@@ -26,7 +26,6 @@ import org.apache.tapestry5.ioc.Configur
import org.apache.tapestry5.ioc.LoggerSource;
import org.apache.tapestry5.ioc.MappedConfiguration;
import org.apache.tapestry5.ioc.OrderedConfiguration;
-import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.ioc.annotations.Symbol;
import org.apache.tapestry5.ioc.services.PropertyAccess;
import org.apache.tapestry5.ioc.services.TypeCoercer;
@@ -59,7 +58,6 @@ public class HibernateModule
*/
public static void contributeHibernateEntityPackageManager(Configuration<String> configuration,
- @Inject
@Symbol(InternalConstants.TAPESTRY_APP_PACKAGE_PARAM)
String appRootPackage)
{
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/AbstractMethodInvokingInstrumenter.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/AbstractMethodInvokingInstrumenter.java?rev=948226&r1=948225&r2=948226&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/AbstractMethodInvokingInstrumenter.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/AbstractMethodInvokingInstrumenter.java Tue May 25 22:35:03 2010
@@ -48,6 +48,7 @@ public class AbstractMethodInvokingInstr
protected final Class serviceInterface;
protected final String serviceId;
+
private final Logger logger;
public AbstractMethodInvokingInstrumenter(
@@ -60,7 +61,6 @@ public class AbstractMethodInvokingInstr
serviceId = resources.getServiceId();
- resourcesDefaults.put(String.class, serviceId);
resourcesDefaults.put(ObjectLocator.class, resources);
resourcesDefaults.put(ServiceResources.class, resources);
logger = resources.getLogger();
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/AbstractServiceCreator.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/AbstractServiceCreator.java?rev=948226&r1=948225&r2=948226&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/AbstractServiceCreator.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/AbstractServiceCreator.java Tue May 25 22:35:03 2010
@@ -56,11 +56,11 @@ public abstract class AbstractServiceCre
public AbstractServiceCreator(ServiceBuilderResources resources, String creatorDescription)
{
serviceId = resources.getServiceId();
+
this.resources = resources;
this.creatorDescription = creatorDescription;
logger = resources.getLogger();
- injectionResources.put(String.class, serviceId);
injectionResources.put(ObjectLocator.class, resources);
injectionResources.put(ServiceResources.class, resources);
injectionResources.put(Logger.class, logger);
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/SymbolSource.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/SymbolSource.java?rev=948226&r1=948225&r2=948226&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/SymbolSource.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/SymbolSource.java Tue May 25 22:35:03 2010
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007, 2008 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 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.
@@ -20,7 +20,7 @@ import org.apache.tapestry5.ioc.annotati
/**
* Used to manage <em>symbols</em>, configuration properties whose value is evaluated at runtime. Symbols use the Ant
* syntax: <code>${foo.bar.baz}</code> where <code>foo.bar.baz</code> is the name of the symbol. The symbol may appear
- * inside annotation, such as {@link Value}.
+ * inside some annotation, such as {@link Value}.
* <p/>
* The SymbolSource service configuration is an ordered list of {@link org.apache.tapestry5.ioc.services.SymbolProvider}s.
* Two key SymbolProvider services are FactoryDefaults and ApplicationDefaults.
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=948226&r1=948225&r2=948226&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/injection.apt (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/injection.apt Tue May 25 22:35:03 2010
@@ -75,14 +75,11 @@ Standard Injection Processing
When the Inject annotation is <not present> at the point of injection, Tapestry checks to see
if a resource can be injected. When the Inject annotation is present, this step is skipped (this is necessary
- when the object to be injected has a type that conflicts with a resource type, such as String).
+ when the object to be injected has a type that conflicts with a resource type, such as List or Class).
[org.slf4j.Logger]
The Logger of the service being constructed (or the logger of the Module class being instantiated).
- [String]
- The service id of the service being constructed.
-
[{{{../apidocs/org/apache/tapestry5/ioc/ObjectLocator.html}ObjectLocator}}]
For contribute methods, used to locate additional objects.
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/CyclicMOPModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/CyclicMOPModule.java?rev=948226&r1=948225&r2=948226&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/CyclicMOPModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/CyclicMOPModule.java Tue May 25 22:35:03 2010
@@ -1,10 +1,10 @@
-// Copyright 2008 The Apache Software Foundation
+// Copyright 2008, 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,
@@ -24,7 +24,8 @@ public class CyclicMOPModule
configuration.add("symbol-value", "99");
}
- public static Runnable decorateTrigger(Runnable delegate, @Symbol("symbol-value")int value)
+ public static Runnable decorateTrigger(Runnable delegate, @Symbol("symbol-value")
+ int value)
{
return delegate;
}
@@ -39,8 +40,8 @@ public class CyclicMOPModule
};
}
- public static void contributeTypeCoercer(Configuration<CoercionTuple> configuration,
- @Symbol("symbol-value")int value)
+ public static void contributeTypeCoercer(Configuration<CoercionTuple> configuration, @Symbol("symbol-value")
+ int value)
{
assert value == 99;
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/FieldResourceServiceImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/FieldResourceServiceImpl.java?rev=948226&r1=948225&r2=948226&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/FieldResourceServiceImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/FieldResourceServiceImpl.java Tue May 25 22:35:03 2010
@@ -1,10 +1,10 @@
-// Copyright 2008 The Apache Software Foundation
+// Copyright 2008, 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,
@@ -21,18 +21,17 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
-
public class FieldResourceServiceImpl implements FieldResourceService
{
@InjectResource
- private String serviceId;
+ private ServiceResources resources;
@InjectResource
private Collection<String> configuration;
public String getServiceId()
{
- return serviceId;
+ return resources.getServiceId();
}
public List<String> getLabels()
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/ServiceIdGreeter.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/ServiceIdGreeter.java?rev=948226&r1=948225&r2=948226&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/ServiceIdGreeter.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/ServiceIdGreeter.java Tue May 25 22:35:03 2010
@@ -1,4 +1,4 @@
-// Copyright 2008 The Apache Software Foundation
+// Copyright 2008, 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.
@@ -26,8 +26,8 @@ public class ServiceIdGreeter implements
}
@PostInjection
- public void finishSetup(String serviceId)
+ public void finishSetup(ServiceResources resources)
{
- greeting = String.format("Greetings from %s.", serviceId);
+ greeting = String.format("Greetings from %s.", resources.getServiceId());
}
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ModuleImplTestModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ModuleImplTestModule.java?rev=948226&r1=948225&r2=948226&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ModuleImplTestModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ModuleImplTestModule.java Tue May 25 22:35:03 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,6 +14,7 @@
package org.apache.tapestry5.ioc.internal;
+import org.apache.tapestry5.ioc.ServiceResources;
import org.apache.tapestry5.ioc.annotations.InjectService;
/**
@@ -31,8 +32,10 @@ public class ModuleImplTestModule
return null;
}
- public ToStringService buildToString(final String serviceId)
+ public ToStringService buildToString(ServiceResources resources)
{
+ final String serviceId = resources.getServiceId();
+
return new ToStringService()
{
@Override
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ServiceBuilderMethodFixture.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ServiceBuilderMethodFixture.java?rev=948226&r1=948225&r2=948226&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ServiceBuilderMethodFixture.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ServiceBuilderMethodFixture.java Tue May 25 22:35:03 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,17 +14,16 @@
package org.apache.tapestry5.ioc.internal;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
import org.apache.tapestry5.ioc.ServiceResources;
-import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.ioc.annotations.InjectService;
import org.apache.tapestry5.ioc.annotations.Value;
import org.slf4j.Logger;
import org.testng.Assert;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
/**
* Used by {@link org.apache.tapestry5.ioc.internal.ServiceBuilderMethodInvokerTest}.
*/
@@ -32,8 +31,6 @@ public class ServiceBuilderMethodFixture
{
FieService fie;
- String expectedServiceId;
-
ServiceResources expectedServiceResources;
Class expectedServiceInterface;
@@ -98,10 +95,8 @@ public class ServiceBuilderMethodFixture
throw new RuntimeException("Method failed.");
}
- public FieService build_args(String serviceId, ServiceResources resources,
- Class serviceInterface, Logger log)
+ public FieService build_args(ServiceResources resources, Class serviceInterface, Logger log)
{
- assertEquals(serviceId, expectedServiceId);
assertSame(resources, expectedServiceResources);
assertSame(serviceInterface, expectedServiceInterface);
assertSame(log, expectedLogger);
@@ -109,8 +104,8 @@ public class ServiceBuilderMethodFixture
return fie;
}
- public FieService build_with_forced_injection(@Inject
- @Value("Injected")
+ /** Before 5.2, an @Inject was necessary here. Now we're testing that it no longer is necessary. */
+ public FieService build_with_forced_injection(@Value("Injected")
String string)
{
assertEquals(string, expectedString);
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ServiceBuilderMethodInvokerTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ServiceBuilderMethodInvokerTest.java?rev=948226&r1=948225&r2=948226&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ServiceBuilderMethodInvokerTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/ServiceBuilderMethodInvokerTest.java Tue May 25 22:35:03 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,
@@ -55,8 +55,8 @@ public class ServiceBuilderMethodInvoker
replay();
- ObjectCreator sc = new ServiceBuilderMethodInvoker(resources, CREATOR_DESCRIPTION,
- findMethod(fixture, "build_noargs"));
+ ObjectCreator sc = new ServiceBuilderMethodInvoker(resources, CREATOR_DESCRIPTION, findMethod(fixture,
+ "build_noargs"));
Object actual = sc.createObject();
@@ -83,7 +83,6 @@ public class ServiceBuilderMethodInvoker
Logger logger = mockLogger();
- fixture.expectedServiceId = SERVICE_ID;
fixture.expectedServiceInterface = FieService.class;
fixture.expectedServiceResources = resources;
fixture.expectedLogger = logger;
@@ -132,8 +131,7 @@ public class ServiceBuilderMethodInvoker
// This simulates what the real stack does when it sees @Value("Injected")
- expect(resources.getObject(eq(String.class), isA(AnnotationProvider.class))).andReturn(
- "Injected");
+ expect(resources.getObject(eq(String.class), isA(AnnotationProvider.class))).andReturn("Injected");
replay();
@@ -166,8 +164,8 @@ public class ServiceBuilderMethodInvoker
replay();
- ObjectCreator sc = new ServiceBuilderMethodInvoker(resources, CREATOR_DESCRIPTION,
- findMethod(fixture, "build_injected"));
+ ObjectCreator sc = new ServiceBuilderMethodInvoker(resources, CREATOR_DESCRIPTION, findMethod(fixture,
+ "build_injected"));
Object actual = sc.createObject();
@@ -198,8 +196,8 @@ public class ServiceBuilderMethodInvoker
replay();
- ObjectCreator sc = new ServiceBuilderMethodInvoker(resources, CREATOR_DESCRIPTION,
- findMethod(fixture, "buildWithOrderedConfiguration"));
+ ObjectCreator sc = new ServiceBuilderMethodInvoker(resources, CREATOR_DESCRIPTION, findMethod(fixture,
+ "buildWithOrderedConfiguration"));
Object actual = sc.createObject();
@@ -230,8 +228,8 @@ public class ServiceBuilderMethodInvoker
replay();
- ObjectCreator sc = new ServiceBuilderMethodInvoker(resources, CREATOR_DESCRIPTION,
- findMethod(fixture, "buildWithUnorderedConfiguration"));
+ ObjectCreator sc = new ServiceBuilderMethodInvoker(resources, CREATOR_DESCRIPTION, findMethod(fixture,
+ "buildWithUnorderedConfiguration"));
Object actual = sc.createObject();
@@ -304,8 +302,8 @@ public class ServiceBuilderMethodInvoker
}
catch (RuntimeException ex)
{
- assertEquals(ex.getMessage(), "Error invoking service builder method "
- + CREATOR_DESCRIPTION + " (for service 'Fie'): Method failed.");
+ assertEquals(ex.getMessage(), "Error invoking service builder method " + CREATOR_DESCRIPTION
+ + " (for service 'Fie'): Method failed.");
Throwable cause = ex.getCause();
@@ -331,8 +329,7 @@ public class ServiceBuilderMethodInvoker
train_getModuleBuilder(resources, fixture);
- expect(resources.getObject(eq(FoeService.class), isA(AnnotationProvider.class))).andReturn(
- fixture.expectedFoe);
+ expect(resources.getObject(eq(FoeService.class), isA(AnnotationProvider.class))).andReturn(fixture.expectedFoe);
train_isDebugEnabled(logger, false);
@@ -347,8 +344,7 @@ public class ServiceBuilderMethodInvoker
assertSame(actual, fixture.fie);
}
- protected final void train_getModuleBuilder(ServiceBuilderResources resources,
- Object moduleInstance)
+ protected final void train_getModuleBuilder(ServiceBuilderResources resources, Object moduleInstance)
{
expect(resources.getModuleBuilder()).andReturn(moduleInstance);
}
Modified: tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry5/upload/internal/services/MultipartDecoderImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry5/upload/internal/services/MultipartDecoderImpl.java?rev=948226&r1=948225&r2=948226&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry5/upload/internal/services/MultipartDecoderImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry5/upload/internal/services/MultipartDecoderImpl.java Tue May 25 22:35:03 2010
@@ -1,10 +1,10 @@
-// Copyright 2007, 2008 The Apache Software Foundation
+// Copyright 2007, 2008, 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,12 +14,18 @@
package org.apache.tapestry5.upload.internal.services;
+import java.io.UnsupportedEncodingException;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.apache.tapestry5.SymbolConstants;
-import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.ioc.annotations.Symbol;
import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
import org.apache.tapestry5.ioc.services.ThreadCleanupListener;
@@ -27,14 +33,8 @@ import org.apache.tapestry5.upload.servi
import org.apache.tapestry5.upload.services.UploadSymbols;
import org.apache.tapestry5.upload.services.UploadedFile;
-import javax.servlet.http.HttpServletRequest;
-import java.io.UnsupportedEncodingException;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
/**
- * Implementation of multipart decoder for servlets. This implementation is perthread scope.
+ * Implementation of multipart decoder for servlets. This implementation is perthread scope.
*/
public class MultipartDecoderImpl implements MultipartDecoder, ThreadCleanupListener
{
@@ -52,16 +52,16 @@ public class MultipartDecoderImpl implem
public MultipartDecoderImpl(
- FileItemFactory fileItemFactory,
+ FileItemFactory fileItemFactory,
- @Symbol(UploadSymbols.REQUESTSIZE_MAX)
- long maxRequestSize,
+ @Symbol(UploadSymbols.REQUESTSIZE_MAX)
+ long maxRequestSize,
- @Symbol(UploadSymbols.FILESIZE_MAX)
- long maxFileSize,
+ @Symbol(UploadSymbols.FILESIZE_MAX)
+ long maxFileSize,
- @Inject @Symbol(SymbolConstants.CHARSET)
- String requestEncoding)
+ @Symbol(SymbolConstants.CHARSET)
+ String requestEncoding)
{
this.fileItemFactory = fileItemFactory;
this.maxRequestSize = maxRequestSize;
@@ -126,10 +126,7 @@ public class MultipartDecoderImpl implem
protected HttpServletRequest processFileItems(HttpServletRequest request, List<FileItem> fileItems)
{
- if (uploadException == null && fileItems.isEmpty())
- {
- return request;
- }
+ if (uploadException == null && fileItems.isEmpty()) { return request; }
ParametersServletRequestWrapper wrapper = new ParametersServletRequestWrapper(request);
Modified: tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry5/upload/services/UploadModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry5/upload/services/UploadModule.java?rev=948226&r1=948225&r2=948226&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry5/upload/services/UploadModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-upload/src/main/java/org/apache/tapestry5/upload/services/UploadModule.java Tue May 25 22:35:03 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,6 +14,9 @@
package org.apache.tapestry5.upload.services;
+import java.io.File;
+import java.util.concurrent.atomic.AtomicBoolean;
+
import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.io.FileCleaner;
@@ -22,7 +25,6 @@ import org.apache.tapestry5.ioc.MappedCo
import org.apache.tapestry5.ioc.OrderedConfiguration;
import org.apache.tapestry5.ioc.ScopeConstants;
import org.apache.tapestry5.ioc.annotations.Autobuild;
-import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.ioc.annotations.Scope;
import org.apache.tapestry5.ioc.annotations.Symbol;
import org.apache.tapestry5.ioc.services.PerthreadManager;
@@ -35,9 +37,6 @@ import org.apache.tapestry5.upload.inter
import org.apache.tapestry5.upload.internal.services.MultipartServletRequestFilter;
import org.apache.tapestry5.upload.internal.services.UploadExceptionFilter;
-import java.io.File;
-import java.util.concurrent.atomic.AtomicBoolean;
-
public class UploadModule
{
private static final String NO_LIMIT = "-1";
@@ -54,9 +53,10 @@ public class UploadModule
@Scope(ScopeConstants.PERTHREAD)
public static MultipartDecoder buildMultipartDecoder(PerthreadManager perthreadManager,
- RegistryShutdownHub shutdownHub,
+ RegistryShutdownHub shutdownHub,
- @Autobuild MultipartDecoderImpl multipartDecoder)
+ @Autobuild
+ MultipartDecoderImpl multipartDecoder)
{
// This is proabably overkill since the FileCleaner should catch temporary files, but lets
// be safe.
@@ -79,8 +79,8 @@ public class UploadModule
/**
* Contributes a filter, "MultipartFilter" after "IgnoredPaths".
*/
- public static void contributeHttpServletRequestHandler(OrderedConfiguration<HttpServletRequestFilter> configuration,
- MultipartDecoder multipartDecoder)
+ public static void contributeHttpServletRequestHandler(
+ OrderedConfiguration<HttpServletRequestFilter> configuration, MultipartDecoder multipartDecoder)
{
configuration.add("MultipartFilter", new MultipartServletRequestFilter(multipartDecoder), "after:IgnoredPaths");
}
@@ -93,19 +93,18 @@ public class UploadModule
public static void contributeComponentEventRequestHandler(
OrderedConfiguration<ComponentEventRequestFilter> configuration)
{
- configuration.addInstance("UploadException", UploadExceptionFilter.class, "after:Secure",
- "before:Ajax");
+ configuration.addInstance("UploadException", UploadExceptionFilter.class, "after:Secure", "before:Ajax");
}
/**
- * The default FileItemFactory used by the MultipartDecoder is {@link org.apache.commons.fileupload.disk.DiskFileItemFactory}.
+ * The default FileItemFactory used by the MultipartDecoder is
+ * {@link org.apache.commons.fileupload.disk.DiskFileItemFactory}.
*/
- public static FileItemFactory buildDefaultFileItemFactory(
- @Symbol(UploadSymbols.REPOSITORY_THRESHOLD)
- int repositoryThreshold,
+ public static FileItemFactory buildDefaultFileItemFactory(@Symbol(UploadSymbols.REPOSITORY_THRESHOLD)
+ int repositoryThreshold,
- @Inject @Symbol(UploadSymbols.REPOSITORY_LOCATION)
- String repositoryLocation)
+ @Symbol(UploadSymbols.REPOSITORY_LOCATION)
+ String repositoryLocation)
{
return new DiskFileItemFactory(repositoryThreshold, new File(repositoryLocation));
}