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 2007/10/28 02:39:31 UTC
svn commit: r589253 - in /tapestry/tapestry5/trunk: src/site/xdoc/
tapestry-core/src/main/java/org/apache/tapestry/internal/services/
tapestry-core/src/main/java/org/apache/tapestry/internal/test/
tapestry-core/src/main/java/org/apache/tapestry/service...
Author: hlship
Date: Sat Oct 27 17:39:29 2007
New Revision: 589253
URL: http://svn.apache.org/viewvc?rev=589253&view=rev
Log:
TAPESTRY-1828: Convert uses of @InjectService to be @Inject plus a marker annotation
Added:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/ComponentLayer.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/ContextProvider.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/ApplicationDefaults.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/FactoryDefaults.java
Modified:
tapestry/tapestry5/trunk/src/site/xdoc/release-notes.xml
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/AssetObjectProvider.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/EnvironmentalShadowBuilderImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/InternalModule.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/test/TestableMarkupWriterFactoryImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TapestryModule.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/services/AppModule.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ChainBuilderImpl.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/DefaultImplementationBuilderImpl.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/LoggingDecoratorImpl.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PerThreadServiceLifecycle.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PipelineBuilderImpl.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PropertyShadowBuilderImpl.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/StrategyBuilderImpl.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/SymbolObjectProvider.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ValueObjectProvider.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/InternalUtils.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/Builtin.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/TapestryIOCModule.java
Modified: tapestry/tapestry5/trunk/src/site/xdoc/release-notes.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/src/site/xdoc/release-notes.xml?rev=589253&r1=589252&r2=589253&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/src/site/xdoc/release-notes.xml (original)
+++ tapestry/tapestry5/trunk/src/site/xdoc/release-notes.xml Sat Oct 27 17:39:29 2007
@@ -1,19 +1,19 @@
<document>
- <!--
- Copyright 2007 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
+<!--
+ Copyright 2007 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ 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.
+-->
<properties>
<title>Tapestry Project Release Notes</title>
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/AssetObjectProvider.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/AssetObjectProvider.java?rev=589253&r1=589252&r2=589253&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/AssetObjectProvider.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/AssetObjectProvider.java Sat Oct 27 17:39:29 2007
@@ -20,7 +20,7 @@
import org.apache.tapestry.ioc.ObjectLocator;
import org.apache.tapestry.ioc.ObjectProvider;
import org.apache.tapestry.ioc.Resource;
-import org.apache.tapestry.ioc.annotations.InjectService;
+import org.apache.tapestry.ioc.services.Builtin;
import org.apache.tapestry.ioc.services.SymbolSource;
import org.apache.tapestry.ioc.services.TypeCoercer;
import org.apache.tapestry.services.AssetSource;
@@ -37,13 +37,13 @@
private final SymbolSource _symbolSource;
- public AssetObjectProvider(@InjectService("AssetSource")
+ public AssetObjectProvider(@Builtin
AssetSource source,
- @InjectService("TypeCoercer")
+ @Builtin
TypeCoercer typeCoercer,
- @InjectService("SymbolSource")
+ @Builtin
SymbolSource symbolSource)
{
_source = source;
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/EnvironmentalShadowBuilderImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/EnvironmentalShadowBuilderImpl.java?rev=589253&r1=589252&r2=589253&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/EnvironmentalShadowBuilderImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/EnvironmentalShadowBuilderImpl.java Sat Oct 27 17:39:29 2007
@@ -19,7 +19,7 @@
import java.lang.reflect.Constructor;
import java.lang.reflect.Modifier;
-import org.apache.tapestry.ioc.annotations.InjectService;
+import org.apache.tapestry.ioc.services.Builtin;
import org.apache.tapestry.ioc.services.ClassFab;
import org.apache.tapestry.ioc.services.ClassFactory;
import org.apache.tapestry.ioc.services.MethodSignature;
@@ -32,7 +32,8 @@
private final Environment _environment;
- public EnvironmentalShadowBuilderImpl(@InjectService("ClassFactory")
+ /** Construct using the default builtin factory, not the component layer version. */
+ public EnvironmentalShadowBuilderImpl(@Builtin
ClassFactory classFactory,
Environment environment)
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/InternalModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/InternalModule.java?rev=589253&r1=589252&r2=589253&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/InternalModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/InternalModule.java Sat Oct 27 17:39:29 2007
@@ -37,9 +37,10 @@
import org.apache.tapestry.ioc.OrderedConfiguration;
import org.apache.tapestry.ioc.ServiceBinder;
import org.apache.tapestry.ioc.ServiceResources;
-import org.apache.tapestry.ioc.annotations.InjectService;
+import org.apache.tapestry.ioc.annotations.Marker;
import org.apache.tapestry.ioc.annotations.Scope;
import org.apache.tapestry.ioc.annotations.Symbol;
+import org.apache.tapestry.ioc.services.Builtin;
import org.apache.tapestry.ioc.services.ChainBuilder;
import org.apache.tapestry.ioc.services.ClassFactory;
import org.apache.tapestry.ioc.services.PropertyAccess;
@@ -58,6 +59,7 @@
import org.apache.tapestry.services.ComponentClassResolver;
import org.apache.tapestry.services.ComponentMessagesSource;
import org.apache.tapestry.services.Context;
+import org.apache.tapestry.services.ContextProvider;
import org.apache.tapestry.services.ObjectRenderer;
import org.apache.tapestry.services.PersistentFieldStrategy;
import org.apache.tapestry.services.PropertyConduitSource;
@@ -69,6 +71,7 @@
import org.apache.tapestry.services.TapestryModule;
import org.slf4j.Logger;
+@Marker(Builtin.class)
public final class InternalModule
{
public static void bind(ServiceBinder binder)
@@ -118,10 +121,10 @@
configuration.add("tapestry.file-check-interval", "1000"); // 1 second
configuration.add("tapestry.file-check-update-timeout", "50"); // 50 milliseconds
-
+
// This should be overridden for particular applications.
configuration.add("tapestry.supported-locales", "en");
-
+
configuration.add("tapestry.default-cookie-max-age", "604800"); // One week
configuration.add("tapestry.start-page-name", "start");
@@ -174,7 +177,7 @@
_requestGlobals = requestGlobals;
}
- public PageTemplateLocator build(@InjectService("ContextAssetFactory")
+ public PageTemplateLocator build(@ContextProvider
AssetFactory contextAssetFactory,
ComponentClassResolver componentClassResolver)
@@ -183,7 +186,7 @@
componentClassResolver);
}
- public ComponentInstantiatorSource build(@InjectService("ClassFactory")
+ public ComponentInstantiatorSource build(@Builtin
ClassFactory classFactory,
ComponentClassTransformer transformer,
@@ -279,6 +282,7 @@
return factory;
}
+ @Marker(ContextProvider.class)
public AssetFactory buildContextAssetFactory(ApplicationGlobals globals)
{
return new ContextAssetFactory(_request, globals.getContext());
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/test/TestableMarkupWriterFactoryImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/test/TestableMarkupWriterFactoryImpl.java?rev=589253&r1=589252&r2=589253&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/test/TestableMarkupWriterFactoryImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/test/TestableMarkupWriterFactoryImpl.java Sat Oct 27 17:39:29 2007
@@ -17,8 +17,8 @@
import static org.apache.tapestry.ioc.IOCConstants.PERTHREAD_SCOPE;
import org.apache.tapestry.MarkupWriter;
-import org.apache.tapestry.ioc.annotations.InjectService;
import org.apache.tapestry.ioc.annotations.Scope;
+import org.apache.tapestry.ioc.services.Builtin;
import org.apache.tapestry.services.MarkupWriterFactory;
@Scope(PERTHREAD_SCOPE)
@@ -28,7 +28,11 @@
private MarkupWriter _lastCreated;
- public TestableMarkupWriterFactoryImpl(@InjectService("MarkupWriterFactory")
+ /**
+ * Using Builtin to reference to framework-provided version, which this implementation wraps
+ * around.
+ */
+ public TestableMarkupWriterFactoryImpl(@Builtin
MarkupWriterFactory delegate)
{
_delegate = delegate;
Added: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/ComponentLayer.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/ComponentLayer.java?rev=589253&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/ComponentLayer.java (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/ComponentLayer.java Sat Oct 27 17:39:29 2007
@@ -0,0 +1,40 @@
+// Copyright 2007 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.services;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import org.apache.tapestry.ioc.services.Builtin;
+
+/**
+ * Used to identify a service from the component layer that conflicts, in terms of service
+ * interface, with a service from elsewhere. In particular, this is used to disambiguate
+ * {@link ComponentClassFactory} which has one implementation (marked with {@link Builtin} and
+ * another with this annotation.
+ */
+@Target(
+{ PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+public @interface ComponentLayer
+{
+
+}
Added: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/ContextProvider.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/ContextProvider.java?rev=589253&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/ContextProvider.java (added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/ContextProvider.java Sat Oct 27 17:39:29 2007
@@ -0,0 +1,36 @@
+// Copyright 2007 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.services;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Used to select the correct {@link AssetFactory} for injection. The marked interface will service
+ * assets located in the web application context.
+ */
+@Target(
+{ PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+public @interface ContextProvider
+{
+
+}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TapestryModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TapestryModule.java?rev=589253&r1=589252&r2=589253&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TapestryModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TapestryModule.java Sat Oct 27 17:39:29 2007
@@ -172,10 +172,12 @@
import org.apache.tapestry.ioc.ServiceResources;
import org.apache.tapestry.ioc.annotations.Inject;
import org.apache.tapestry.ioc.annotations.InjectService;
+import org.apache.tapestry.ioc.annotations.Marker;
import org.apache.tapestry.ioc.annotations.SubModule;
import org.apache.tapestry.ioc.annotations.Symbol;
import org.apache.tapestry.ioc.annotations.Value;
import org.apache.tapestry.ioc.internal.util.InternalUtils;
+import org.apache.tapestry.ioc.services.Builtin;
import org.apache.tapestry.ioc.services.ChainBuilder;
import org.apache.tapestry.ioc.services.ClassFactory;
import org.apache.tapestry.ioc.services.Coercion;
@@ -208,6 +210,7 @@
* The root module for Tapestry.
*/
@SubModule(InternalModule.class)
+@Marker(Builtin.class)
public final class TapestryModule
{
public static void bind(ServiceBinder binder)
@@ -1216,6 +1219,7 @@
* dipping into the internals side to register for the correct notifications). Failure to
* properly clean up can result in really nasty PermGen space memory leaks.
*/
+ @Marker(ComponentLayer.class)
public ClassFactory buildComponentClassFactory()
{
return _shadowBuilder.build(
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/services/AppModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/services/AppModule.java?rev=589253&r1=589252&r2=589253&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/services/AppModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/app1/services/AppModule.java Sat Oct 27 17:39:29 2007
@@ -14,14 +14,20 @@
package org.apache.tapestry.integration.app1.services;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
import java.io.IOException;
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
import java.net.URL;
import java.util.List;
import org.apache.tapestry.integration.app1.data.Track;
import org.apache.tapestry.ioc.MappedConfiguration;
import org.apache.tapestry.ioc.OrderedConfiguration;
-import org.apache.tapestry.ioc.annotations.InjectService;
import org.apache.tapestry.ioc.annotations.Marker;
import org.apache.tapestry.services.Request;
import org.apache.tapestry.services.RequestFilter;
@@ -34,6 +40,19 @@
*/
public class AppModule
{
+ /**
+ * Used to disambiguate services in this module from services in other modules that share the
+ * same service interface.
+ */
+ @Target(
+ { PARAMETER, FIELD })
+ @Retention(RUNTIME)
+ @Documented
+ public @interface Local
+ {
+
+ }
+
public RequestFilter buildTimingFilter(final Logger log)
{
return new RequestFilter()
@@ -58,8 +77,9 @@
}
public void contributeRequestHandler(OrderedConfiguration<RequestFilter> configuration,
- @InjectService("TimingFilter")
- RequestFilter filter)
+
+ @Local
+ RequestFilter filter)
{
configuration.add("Timing", filter);
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ChainBuilderImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ChainBuilderImpl.java?rev=589253&r1=589252&r2=589253&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ChainBuilderImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ChainBuilderImpl.java Sat Oct 27 17:39:29 2007
@@ -22,7 +22,7 @@
import java.util.List;
import java.util.Map;
-import org.apache.tapestry.ioc.annotations.InjectService;
+import org.apache.tapestry.ioc.services.Builtin;
import org.apache.tapestry.ioc.services.ChainBuilder;
import org.apache.tapestry.ioc.services.ClassFab;
import org.apache.tapestry.ioc.services.ClassFabUtils;
@@ -41,7 +41,7 @@
private Map<Class, Class> _cache = newConcurrentMap();
- public ChainBuilderImpl(@InjectService("ClassFactory")
+ public ChainBuilderImpl(@Builtin
ClassFactory classFactory)
{
_classFactory = classFactory;
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/DefaultImplementationBuilderImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/DefaultImplementationBuilderImpl.java?rev=589253&r1=589252&r2=589253&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/DefaultImplementationBuilderImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/DefaultImplementationBuilderImpl.java Sat Oct 27 17:39:29 2007
@@ -19,7 +19,7 @@
import java.util.Map;
-import org.apache.tapestry.ioc.annotations.InjectService;
+import org.apache.tapestry.ioc.services.Builtin;
import org.apache.tapestry.ioc.services.ClassFab;
import org.apache.tapestry.ioc.services.ClassFactory;
import org.apache.tapestry.ioc.services.DefaultImplementationBuilder;
@@ -35,7 +35,7 @@
private final ClassFactory _classFactory;
- public DefaultImplementationBuilderImpl(@InjectService("ClassFactory")
+ public DefaultImplementationBuilderImpl(@Builtin
ClassFactory classFactory)
{
_classFactory = classFactory;
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/LoggingDecoratorImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/LoggingDecoratorImpl.java?rev=589253&r1=589252&r2=589253&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/LoggingDecoratorImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/LoggingDecoratorImpl.java Sat Oct 27 17:39:29 2007
@@ -21,7 +21,7 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Modifier;
-import org.apache.tapestry.ioc.annotations.InjectService;
+import org.apache.tapestry.ioc.services.Builtin;
import org.apache.tapestry.ioc.services.ClassFab;
import org.apache.tapestry.ioc.services.ClassFactory;
import org.apache.tapestry.ioc.services.ExceptionTracker;
@@ -37,7 +37,7 @@
private final ExceptionTracker _exceptionTracker;
- public LoggingDecoratorImpl(@InjectService("ClassFactory")
+ public LoggingDecoratorImpl(@Builtin
ClassFactory classFactory,
ExceptionTracker exceptionTracker)
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PerThreadServiceLifecycle.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PerThreadServiceLifecycle.java?rev=589253&r1=589252&r2=589253&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PerThreadServiceLifecycle.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PerThreadServiceLifecycle.java Sat Oct 27 17:39:29 2007
@@ -23,7 +23,7 @@
import org.apache.tapestry.ioc.ObjectCreator;
import org.apache.tapestry.ioc.ServiceLifecycle;
import org.apache.tapestry.ioc.ServiceResources;
-import org.apache.tapestry.ioc.annotations.InjectService;
+import org.apache.tapestry.ioc.services.Builtin;
import org.apache.tapestry.ioc.services.ClassFab;
import org.apache.tapestry.ioc.services.ClassFactory;
import org.apache.tapestry.ioc.services.MethodSignature;
@@ -49,8 +49,9 @@
private static final String PER_THREAD_METHOD_NAME = "_perThreadInstance";
public PerThreadServiceLifecycle(ThreadCleanupHub threadCleanupHub,
- @InjectService("ClassFactory")
- ClassFactory classFactory)
+
+ @Builtin
+ ClassFactory classFactory)
{
_threadCleanupHub = threadCleanupHub;
_classFactory = classFactory;
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PipelineBuilderImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PipelineBuilderImpl.java?rev=589253&r1=589252&r2=589253&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PipelineBuilderImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PipelineBuilderImpl.java Sat Oct 27 17:39:29 2007
@@ -16,7 +16,7 @@
import java.util.List;
-import org.apache.tapestry.ioc.annotations.InjectService;
+import org.apache.tapestry.ioc.services.Builtin;
import org.apache.tapestry.ioc.services.ClassFactory;
import org.apache.tapestry.ioc.services.DefaultImplementationBuilder;
import org.apache.tapestry.ioc.services.PipelineBuilder;
@@ -28,7 +28,7 @@
private final DefaultImplementationBuilder _defaultImplementationBuilder;
- public PipelineBuilderImpl(@InjectService("ClassFactory")
+ public PipelineBuilderImpl(@Builtin
ClassFactory classFactory,
DefaultImplementationBuilder defaultImplementationBuilder)
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PropertyShadowBuilderImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PropertyShadowBuilderImpl.java?rev=589253&r1=589252&r2=589253&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PropertyShadowBuilderImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PropertyShadowBuilderImpl.java Sat Oct 27 17:39:29 2007
@@ -19,7 +19,7 @@
import java.lang.reflect.Constructor;
import java.lang.reflect.Modifier;
-import org.apache.tapestry.ioc.annotations.InjectService;
+import org.apache.tapestry.ioc.services.Builtin;
import org.apache.tapestry.ioc.services.ClassFab;
import org.apache.tapestry.ioc.services.ClassFactory;
import org.apache.tapestry.ioc.services.MethodSignature;
@@ -33,7 +33,7 @@
private final PropertyAccess _propertyAccess;
- public PropertyShadowBuilderImpl(@InjectService("ClassFactory")
+ public PropertyShadowBuilderImpl(@Builtin
ClassFactory classFactory,
PropertyAccess propertyAccess)
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/StrategyBuilderImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/StrategyBuilderImpl.java?rev=589253&r1=589252&r2=589253&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/StrategyBuilderImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/StrategyBuilderImpl.java Sat Oct 27 17:39:29 2007
@@ -16,7 +16,7 @@
import java.lang.reflect.Modifier;
-import org.apache.tapestry.ioc.annotations.InjectService;
+import org.apache.tapestry.ioc.services.Builtin;
import org.apache.tapestry.ioc.services.ClassFab;
import org.apache.tapestry.ioc.services.ClassFactory;
import org.apache.tapestry.ioc.services.MethodIterator;
@@ -29,7 +29,7 @@
{
private final ClassFactory _classFactory;
- public StrategyBuilderImpl(@InjectService("ClassFactory")
+ public StrategyBuilderImpl(@Builtin
ClassFactory classFactory)
{
_classFactory = classFactory;
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/SymbolObjectProvider.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/SymbolObjectProvider.java?rev=589253&r1=589252&r2=589253&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/SymbolObjectProvider.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/SymbolObjectProvider.java Sat Oct 27 17:39:29 2007
@@ -17,8 +17,8 @@
import org.apache.tapestry.ioc.AnnotationProvider;
import org.apache.tapestry.ioc.ObjectLocator;
import org.apache.tapestry.ioc.ObjectProvider;
-import org.apache.tapestry.ioc.annotations.InjectService;
import org.apache.tapestry.ioc.annotations.Symbol;
+import org.apache.tapestry.ioc.services.Builtin;
import org.apache.tapestry.ioc.services.SymbolSource;
import org.apache.tapestry.ioc.services.TypeCoercer;
@@ -31,10 +31,10 @@
private final TypeCoercer _typeCoercer;
- public SymbolObjectProvider(@InjectService("SymbolSource")
+ public SymbolObjectProvider(@Builtin
SymbolSource symbolSource,
- @InjectService("TypeCoercer")
+ @Builtin
TypeCoercer typeCoercer)
{
_symbolSource = symbolSource;
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ValueObjectProvider.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ValueObjectProvider.java?rev=589253&r1=589252&r2=589253&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ValueObjectProvider.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ValueObjectProvider.java Sat Oct 27 17:39:29 2007
@@ -17,21 +17,25 @@
import org.apache.tapestry.ioc.AnnotationProvider;
import org.apache.tapestry.ioc.ObjectLocator;
import org.apache.tapestry.ioc.ObjectProvider;
-import org.apache.tapestry.ioc.annotations.InjectService;
import org.apache.tapestry.ioc.annotations.Value;
+import org.apache.tapestry.ioc.services.Builtin;
import org.apache.tapestry.ioc.services.SymbolSource;
import org.apache.tapestry.ioc.services.TypeCoercer;
+/**
+ * Provides an object when the {@link Value} annotation is present. The string value has symbols
+ * expanded, and then is {@link TypeCoercer coerced} to the associated type.
+ */
public class ValueObjectProvider implements ObjectProvider
{
private final SymbolSource _symbolSource;
private final TypeCoercer _typeCoercer;
- public ValueObjectProvider(@InjectService("SymbolSource")
+ public ValueObjectProvider(@Builtin
SymbolSource symbolSource,
- @InjectService("TypeCoercer")
+ @Builtin
TypeCoercer typeCoercer)
{
_symbolSource = symbolSource;
@@ -47,6 +51,7 @@
String value = annotation.value();
String expanded = _symbolSource.expandSymbols(value);
+
T coerced = _typeCoercer.coerce(expanded, objectType);
return coerced;
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/InternalUtils.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/InternalUtils.java?rev=589253&r1=589252&r2=589253&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/InternalUtils.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/InternalUtils.java Sat Oct 27 17:39:29 2007
@@ -192,6 +192,9 @@
};
+ // At some point, it would be nice to eliminate InjectService, and rely
+ // entirely on service interface type and point-of-injection markers.
+
InjectService is = provider.getAnnotation(InjectService.class);
if (is != null)
@@ -467,13 +470,13 @@
/**
* Adds a value to a specially organized map where the values are lists of objects. This
* somewhat simulates a map that allows mutiple values for the same key.
+ *
* @param map
* to store value into
* @param key
* for which a value is added
* @param value
* to add
- *
* @param <K>
* the type of key
* @param <V>
Added: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/ApplicationDefaults.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/ApplicationDefaults.java?rev=589253&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/ApplicationDefaults.java (added)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/ApplicationDefaults.java Sat Oct 27 17:39:29 2007
@@ -0,0 +1,38 @@
+// Copyright 2007 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.ioc.services;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Used to disambiguate which version of {@link SymbolProvider} is being referenced. Contributions
+ * to the ApplicationDefaults symbol source are overridden by JVM System properties.
+ *
+ * @see FactoryDefaults
+ */
+@Target(
+{ PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+public @interface ApplicationDefaults
+{
+
+}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/Builtin.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/Builtin.java?rev=589253&r1=589252&r2=589253&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/Builtin.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/Builtin.java Sat Oct 27 17:39:29 2007
@@ -1,3 +1,17 @@
+// Copyright 2007 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package org.apache.tapestry.ioc.services;
import static java.lang.annotation.ElementType.FIELD;
Added: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/FactoryDefaults.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/FactoryDefaults.java?rev=589253&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/FactoryDefaults.java (added)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/FactoryDefaults.java Sat Oct 27 17:39:29 2007
@@ -0,0 +1,36 @@
+// Copyright 2007 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.ioc.services;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Used to disambiguate which version of {@link SymbolProvider} is being referenced. Symbols defined
+ * by contributing to FactoryDefaults are overridden by contributions to {@link ApplicationDefaults}.
+ */
+@Target(
+{ PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+public @interface FactoryDefaults
+{
+
+}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/TapestryIOCModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/TapestryIOCModule.java?rev=589253&r1=589252&r2=589253&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/TapestryIOCModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/TapestryIOCModule.java Sat Oct 27 17:39:29 2007
@@ -33,7 +33,6 @@
import org.apache.tapestry.ioc.OrderedConfiguration;
import org.apache.tapestry.ioc.ServiceBinder;
import org.apache.tapestry.ioc.ServiceLifecycle;
-import org.apache.tapestry.ioc.annotations.InjectService;
import org.apache.tapestry.ioc.annotations.Marker;
import org.apache.tapestry.ioc.annotations.Value;
import org.apache.tapestry.ioc.internal.services.ChainBuilderImpl;
@@ -77,8 +76,10 @@
binder.bind(TypeCoercer.class, TypeCoercerImpl.class);
binder.bind(ThreadLocale.class, ThreadLocaleImpl.class);
binder.bind(SymbolSource.class, SymbolSourceImpl.class);
- binder.bind(SymbolProvider.class, MapSymbolProvider.class).withId("ApplicationDefaults");
- binder.bind(SymbolProvider.class, MapSymbolProvider.class).withId("FactoryDefaults");
+ binder.bind(SymbolProvider.class, MapSymbolProvider.class).withId("ApplicationDefaults")
+ .withMarker(ApplicationDefaults.class);
+ binder.bind(SymbolProvider.class, MapSymbolProvider.class).withId("FactoryDefaults")
+ .withMarker(FactoryDefaults.class);
binder.bind(Runnable.class, RegistryStartup.class).withId("RegistryStartup");
binder.bind(MasterObjectProvider.class, MasterObjectProviderImpl.class);
}
@@ -423,8 +424,10 @@
}
public static void contributeSymbolSource(OrderedConfiguration<SymbolProvider> configuration,
- @InjectService("ApplicationDefaults")
- SymbolProvider applicationDefaults, @InjectService("FactoryDefaults")
+ @ApplicationDefaults
+ SymbolProvider applicationDefaults,
+
+ @FactoryDefaults
SymbolProvider factoryDefaults)
{
configuration.add("SystemProperties", new SystemPropertiesSymbolProvider());