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

svn commit: r526045 - in /tapestry/tapestry5: tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/ tapestry-core/trunk/src/main/java/org/apache/tapestry/services/ tapestry-hibernate/trunk/src/main/java/org/apache/tapestry/hibernate/...

Author: hlship
Date: Thu Apr  5 21:05:34 2007
New Revision: 526045

URL: http://svn.apache.org/viewvc?view=rev&rev=526045
Log:
Rename the Tapestry IoC @Lifecycle annotation to the more widely recognized name, @Scope.

Added:
    tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/annotations/Scope.java
      - copied, changed from r516833, tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/annotations/Lifecycle.java
    tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/UnknownScopeModule.java
      - copied, changed from r516840, tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/UnknownLifecycleModule.java
Removed:
    tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/annotations/Lifecycle.java
    tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/UnknownLifecycleModule.java
Modified:
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InternalModule.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/TapestryModule.java
    tapestry/tapestry5/tapestry-hibernate/trunk/src/main/java/org/apache/tapestry/hibernate/HibernateModule.java
    tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/def/ServiceDef.java
    tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImpl.java
    tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/IOCInternalTestCase.java
    tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/IOCMessages.java
    tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/InternalRegistry.java
    tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/ModuleImpl.java
    tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/RegistryImpl.java
    tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/ServiceDefImpl.java
    tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/services/TapestryIOCModule.java
    tapestry/tapestry5/tapestry-ioc/trunk/src/main/resources/org/apache/tapestry/ioc/internal/IOCStrings.properties
    tapestry/tapestry5/tapestry-ioc/trunk/src/site/apt/index.apt
    tapestry/tapestry5/tapestry-ioc/trunk/src/site/apt/service.apt
    tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/IntegrationTest.java
    tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/PerThreadModule.java
    tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImplTest.java
    tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/SimpleModule.java
    tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/AnnotatedBean.java
    tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/PropertyAccessImplTest.java

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InternalModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InternalModule.java?view=diff&rev=526045&r1=526044&r2=526045
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InternalModule.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InternalModule.java Thu Apr  5 21:05:34 2007
@@ -39,7 +39,7 @@
 import org.apache.tapestry.ioc.OrderedConfiguration;
 import org.apache.tapestry.ioc.annotations.Inject;
 import org.apache.tapestry.ioc.annotations.InjectService;
-import org.apache.tapestry.ioc.annotations.Lifecycle;
+import org.apache.tapestry.ioc.annotations.Scope;
 import org.apache.tapestry.ioc.annotations.Value;
 import org.apache.tapestry.ioc.services.ChainBuilder;
 import org.apache.tapestry.ioc.services.ClassFactory;
@@ -76,7 +76,7 @@
 
 public final class InternalModule
 {
-    @Lifecycle("perthread")
+    @Scope("perthread")
     public static TemplateParser build(Log log, Map<String, URL> configuration)
     {
         return new TemplateParserImpl(log, configuration);
@@ -124,7 +124,7 @@
         return new NoOpComponentInvocationMap();
     }
 
-    @Lifecycle("perthread")
+    @Scope("perthread")
     public static ObjectRenderer buildLocationRenderer()
     {
         return new LocationRenderer();
@@ -338,7 +338,7 @@
         return service;
     }
 
-    @Lifecycle("perthread")
+    @Scope("perthread")
     public RequestPageCache build(@InjectService("PagePool")
     PagePool pagePool)
     {

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/TapestryModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/TapestryModule.java?view=diff&rev=526045&r1=526044&r2=526045
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/TapestryModule.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/TapestryModule.java Thu Apr  5 21:05:34 2007
@@ -165,7 +165,7 @@
 import org.apache.tapestry.ioc.ServiceLocator;
 import org.apache.tapestry.ioc.annotations.Inject;
 import org.apache.tapestry.ioc.annotations.InjectService;
-import org.apache.tapestry.ioc.annotations.Lifecycle;
+import org.apache.tapestry.ioc.annotations.Scope;
 import org.apache.tapestry.ioc.annotations.SubModule;
 import org.apache.tapestry.ioc.annotations.Value;
 import org.apache.tapestry.ioc.internal.util.InternalUtils;
@@ -363,7 +363,7 @@
         return new CookiesImpl(contextPathSource, cookieSource, cookieSink, defaultMaxAge);
     }
 
-    @Lifecycle("perthread")
+    @Scope("perthread")
     public static Environment buildEnvironment()
     {
         return new EnvironmentImpl();
@@ -389,7 +389,7 @@
         return new AliasManagerImpl(log, configuration);
     }
 
-    @Lifecycle("perthread")
+    @Scope("perthread")
     public static RequestGlobals buildRequestGlobals()
     {
         return new RequestGlobalsImpl();

Modified: tapestry/tapestry5/tapestry-hibernate/trunk/src/main/java/org/apache/tapestry/hibernate/HibernateModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-hibernate/trunk/src/main/java/org/apache/tapestry/hibernate/HibernateModule.java?view=diff&rev=526045&r1=526044&r2=526045
==============================================================================
--- tapestry/tapestry5/tapestry-hibernate/trunk/src/main/java/org/apache/tapestry/hibernate/HibernateModule.java (original)
+++ tapestry/tapestry5/tapestry-hibernate/trunk/src/main/java/org/apache/tapestry/hibernate/HibernateModule.java Thu Apr  5 21:05:34 2007
@@ -23,7 +23,7 @@
 import org.apache.tapestry.ioc.Configuration;
 import org.apache.tapestry.ioc.annotations.Inject;
 import org.apache.tapestry.ioc.annotations.InjectService;
-import org.apache.tapestry.ioc.annotations.Lifecycle;
+import org.apache.tapestry.ioc.annotations.Scope;
 import org.apache.tapestry.ioc.services.PropertyShadowBuilder;
 import org.apache.tapestry.ioc.services.ThreadCleanupHub;
 import org.apache.tapestry.services.AliasContribution;
@@ -62,7 +62,7 @@
      * The session manager manages sessions on a per-thread/per-request basis. A {@link Transaction}
      * is created initially, and is committed at the end of the request.
      */
-    @Lifecycle("perthread")
+    @Scope("perthread")
     public static HibernateSessionManager build(@InjectService("HibernateSessionSource")
     HibernateSessionSource sessionSource,
 

Copied: tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/annotations/Scope.java (from r516833, tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/annotations/Lifecycle.java)
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/annotations/Scope.java?view=diff&rev=526045&p1=tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/annotations/Lifecycle.java&r1=516833&p2=tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/annotations/Scope.java&r2=526045
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/annotations/Lifecycle.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/annotations/Scope.java Thu Apr  5 21:05:34 2007
@@ -12,27 +12,32 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package org.apache.tapestry.ioc.annotations;
-
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * An optional annotation that may be placed on a service building method of a module. The
- * annotation overrides the default lifecycle for services (the default being a global singleton
- * that is instantiated on demand) for an alternate lifecycle. Alternate lifecycles are typically
- * used to bind a service implementation to a single thread or request.
- * 
- * 
- */
-@Target(METHOD)
-@Retention(RUNTIME)
-@Documented
-public @interface Lifecycle {
-    /** An identifier used to look up a non-default lifecycle. */
-    String value();
-}
+package org.apache.tapestry.ioc.annotations;
+
+import static java.lang.annotation.ElementType.METHOD;
+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.ServiceLifecycle;
+import org.apache.tapestry.ioc.services.ServiceLifecycleSource;
+
+/**
+ * An optional annotation that may be placed on a service building method of a module. The
+ * annotation overrides the default scope for services (the default being a global singleton that is
+ * instantiated on demand) for an alternate lifecycle. Alternate lifecycles are typically used to
+ * bind a service implementation to a single thread or request. Modules may define new scopes. Each
+ * scope should have a corresponding {@link ServiceLifecycle} implementation. The linkage from scope
+ * name to service lifecycle occurs via a contribution to the {@link ServiceLifecycleSource} service
+ * configuration.
+ */
+@Target(METHOD)
+@Retention(RUNTIME)
+@Documented
+public @interface Scope
+{
+    /** An identifier used to look up a non-default lifecycle. */
+    String value();
+}

Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/def/ServiceDef.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/def/ServiceDef.java?view=diff&rev=526045&r1=526044&r2=526045
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/def/ServiceDef.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/def/ServiceDef.java Thu Apr  5 21:05:34 2007
@@ -42,10 +42,10 @@
 
     /**
      * Returns the lifecycle defined for the service. This is indicated by adding a
-     * {@link org.apache.tapestry.ioc.annotations.Lifecycle} annotation to the service builder
+     * {@link org.apache.tapestry.ioc.annotations.Scope} annotation to the service builder
      * method for the service.
      */
-    String getServiceLifeycle();
+    String getServiceScope();
 
     /**
      * Returns true if the service should be eagerly loaded at Registry startup.

Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImpl.java?view=diff&rev=526045&r1=526044&r2=526045
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImpl.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImpl.java Thu Apr  5 21:05:34 2007
@@ -36,7 +36,7 @@
 import org.apache.tapestry.ioc.MappedConfiguration;
 import org.apache.tapestry.ioc.OrderedConfiguration;
 import org.apache.tapestry.ioc.annotations.EagerLoad;
-import org.apache.tapestry.ioc.annotations.Lifecycle;
+import org.apache.tapestry.ioc.annotations.Scope;
 import org.apache.tapestry.ioc.annotations.Match;
 import org.apache.tapestry.ioc.annotations.Order;
 import org.apache.tapestry.ioc.def.ContributionDef;
@@ -308,9 +308,9 @@
 
     private String extractLifecycle(Method method)
     {
-        Lifecycle lifecycle = method.getAnnotation(Lifecycle.class);
+        Scope scope = method.getAnnotation(Scope.class);
 
-        return lifecycle != null ? lifecycle.value() : IOCConstants.DEFAULT_LIFECYCLE;
+        return scope != null ? scope.value() : IOCConstants.DEFAULT_LIFECYCLE;
     }
 
     public Set<DecoratorDef> getDecoratorDefs()

Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/IOCInternalTestCase.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/IOCInternalTestCase.java?view=diff&rev=526045&r1=526044&r2=526045
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/IOCInternalTestCase.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/IOCInternalTestCase.java Thu Apr  5 21:05:34 2007
@@ -105,10 +105,10 @@
         return newMock(InternalRegistry.class);
     }
 
-    protected final void train_getLifecycle(InternalRegistry registry, String name,
+    protected final void train_getLifecycle(InternalRegistry registry, String scope,
             ServiceLifecycle lifecycle)
     {
-        expect(registry.getServiceLifecycle(name)).andReturn(lifecycle);
+        expect(registry.getServiceLifecycle(scope)).andReturn(lifecycle);
     }
 
     protected final <T> void train_getService(InternalRegistry registry, String serviceId,

Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/IOCMessages.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/IOCMessages.java?view=diff&rev=526045&r1=526044&r2=526045
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/IOCMessages.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/IOCMessages.java Thu Apr  5 21:05:34 2007
@@ -109,9 +109,9 @@
                 buffer.toString());
     }
 
-    static String unknownLifecycle(String name)
+    static String unknownScope(String name)
     {
-        return MESSAGES.format("unknown-lifecycle", name);
+        return MESSAGES.format("unknown-scope", name);
     }
 
     static String decoratorMethodNeedsDelegateParameter(Method method)

Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/InternalRegistry.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/InternalRegistry.java?view=diff&rev=526045&r1=526044&r2=526045
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/InternalRegistry.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/InternalRegistry.java Thu Apr  5 21:05:34 2007
@@ -65,15 +65,15 @@
     <T> T getService(Class<T> serviceInterface);
 
     /**
-     * Returns a service lifecycle by name.
+     * Returns a service lifecycle by service scope name.
      * 
-     * @param lifecycle
-     *            the name of the lifecycle
-     * @return the lifecycle instance
+     * @param scope
+     *            the name of the service scope (case insensitive)
+     * @return the lifecycle corresponding to the scope
      * @throws RuntimeException
      *             if the lifecycle name does not match a known lifecycle
      */
-    ServiceLifecycle getServiceLifecycle(String lifecycle);
+    ServiceLifecycle getServiceLifecycle(String scope);
 
     /**
      * Searches for decorators for a particular service. The resulting

Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/ModuleImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/ModuleImpl.java?view=diff&rev=526045&r1=526044&r2=526045
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/ModuleImpl.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/ModuleImpl.java Thu Apr  5 21:05:34 2007
@@ -211,7 +211,7 @@
 
         try
         {
-            ServiceLifecycle lifecycle = _registry.getServiceLifecycle(def.getServiceLifeycle());
+            ServiceLifecycle lifecycle = _registry.getServiceLifecycle(def.getServiceScope());
 
             ServiceBuilderResources resources = new ServiceResourcesImpl(_registry, this, def, log);
 

Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/RegistryImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/RegistryImpl.java?view=diff&rev=526045&r1=526044&r2=526045
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/RegistryImpl.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/RegistryImpl.java Thu Apr  5 21:05:34 2007
@@ -510,21 +510,21 @@
         }
     }
 
-    public ServiceLifecycle getServiceLifecycle(String lifecycle)
+    public ServiceLifecycle getServiceLifecycle(String scope)
     {
         _lock.check();
 
-        ServiceLifecycle result = _lifecycles.get(lifecycle);
+        ServiceLifecycle result = _lifecycles.get(scope);
 
         if (result == null)
         {
             ServiceLifecycleSource source = getService(
                     "ServiceLifecycleSource",
                     ServiceLifecycleSource.class);
-            result = source.get(lifecycle);
+            result = source.get(scope);
         }
 
-        if (result == null) throw new RuntimeException(IOCMessages.unknownLifecycle(lifecycle));
+        if (result == null) throw new RuntimeException(IOCMessages.unknownScope(scope));
 
         return result;
     }

Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/ServiceDefImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/ServiceDefImpl.java?view=diff&rev=526045&r1=526044&r2=526045
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/ServiceDefImpl.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/ServiceDefImpl.java Thu Apr  5 21:05:34 2007
@@ -28,17 +28,17 @@
 
     private final String _serviceId;
 
-    private final String _lifecycle;
+    private final String _scope;
 
     private final boolean _eagerLoad;
 
     private final ClassFactory _classFactory;
 
-    ServiceDefImpl(String serviceId, String lifecycle, Method builderMethod, boolean eagerLoad,
+    ServiceDefImpl(String serviceId, String scope, Method builderMethod, boolean eagerLoad,
             ClassFactory classFactory)
     {
         _serviceId = serviceId;
-        _lifecycle = lifecycle;
+        _scope = scope;
         _builderMethod = builderMethod;
         _eagerLoad = eagerLoad;
         _classFactory = classFactory;
@@ -70,9 +70,9 @@
         return _builderMethod.getReturnType();
     }
 
-    public String getServiceLifeycle()
+    public String getServiceScope()
     {
-        return _lifecycle;
+        return _scope;
     }
 
     public boolean isEagerLoad()

Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/services/TapestryIOCModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/services/TapestryIOCModule.java?view=diff&rev=526045&r1=526044&r2=526045
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/services/TapestryIOCModule.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/services/TapestryIOCModule.java Thu Apr  5 21:05:34 2007
@@ -30,7 +30,7 @@
 import org.apache.tapestry.ioc.ServiceLifecycle;
 import org.apache.tapestry.ioc.ServiceLocator;
 import org.apache.tapestry.ioc.annotations.InjectService;
-import org.apache.tapestry.ioc.annotations.Lifecycle;
+import org.apache.tapestry.ioc.annotations.Scope;
 import org.apache.tapestry.ioc.annotations.Value;
 import org.apache.tapestry.ioc.internal.services.ChainBuilderImpl;
 import org.apache.tapestry.ioc.internal.services.DefaultImplementationBuilderImpl;
@@ -204,7 +204,7 @@
     }
 
     /** Used by the {@link org.apache.tapestry.ioc.services.LoggingDecorator} service. */
-    @Lifecycle("perthread")
+    @Scope("perthread")
     public static ExceptionTracker buildExceptionTracker()
     {
         return new ExceptionTrackerImpl();
@@ -448,7 +448,7 @@
         configuration.add(tuple);
     }
 
-    @Lifecycle("perthread")
+    @Scope("perthread")
     public static ThreadLocale buildThreadLocale()
     {
         return new ThreadLocaleImpl();

Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/main/resources/org/apache/tapestry/ioc/internal/IOCStrings.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/main/resources/org/apache/tapestry/ioc/internal/IOCStrings.properties?view=diff&rev=526045&r1=526044&r2=526045
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/main/resources/org/apache/tapestry/ioc/internal/IOCStrings.properties (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/main/resources/org/apache/tapestry/ioc/internal/IOCStrings.properties Thu Apr  5 21:05:34 2007
@@ -28,7 +28,7 @@
 no-service-matches-type=No service implements the interface %s.
 many-service-matches=Service interface %s is matched by %d services: %s.  \
   Automatic dependency resolution requires that exactly one service implement the interface.
-unknown-lifecycle=Unknown service lifecycle '%s'.
+unknown-scope=Unknown service scope '%s'.
 decorator-method-needs-delegate-parameter=Decorator methods must a parameter for the service delegate \
  (i.e., the object the created interceptor will delegate to). \
  Method %s does not include such a parameter, and has been ignored.

Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/site/apt/index.apt?view=diff&rev=526045&r1=526044&r2=526045
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/site/apt/index.apt (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/site/apt/index.apt Thu Apr  5 21:05:34 2007
@@ -187,8 +187,8 @@
   constructed. This occurs in a completely <<thread-safe>> manner. Just-in-time instantiation allows for more complex, more finely grained networks of services, and improves
   startup time.
   
-  Services define a <<lifecycle>> that controls when the service is constructed.  The default lifecycle is <<singleton>>, meaning a single
-  global instance created as needed.  Other lifecycles allow service implementations to be bound to the current thread (i.e., the current
+  Services define a <<scope>> that controls when the service is constructed, as well as its visiblity.  The default scope is <<singleton>>, meaning a single
+  global instance created as needed.  Other scopes allow service implementations to be bound to the current thread (i.e., the current
   request in a servlet application).
   
   <<Dependencies>> are other services (or other objects) that are needed by a service implementation. These 

Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/site/apt/service.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/site/apt/service.apt?view=diff&rev=526045&r1=526044&r2=526045
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/site/apt/service.apt (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/site/apt/service.apt Thu Apr  5 21:05:34 2007
@@ -79,20 +79,20 @@
   {{{module.html#Caching Services}cache dependency injections}} in your module, by defining
   a constructor.  This reduces duplication in your module.
     
-Defining Service Lifecycle
+Defining Service Scope
 
   Each service has a <lifecycle> that controls when the service implementation is instantiated.
   There are two built in lifecycles: "singleton" and "perthread", but
   more can be added.
   
   Service lifecycle is specified using the 
-  {{{apidocs/org/apache/tapestry/ioc/annotations/Lifeycle.html}@Lifecycle annotation}},
+  {{{apidocs/org/apache/tapestry/ioc/annotations/Scope.html}@Scope annotation}},
   which is attached to a builder method.  When this annotation is not present, the
-  default lifecycle, "singleton" is used.
+  default scope, "singleton" is used.
     
 * singleton
   
-  Most services use the default lifecycle, "singleton".  With this lifecycle a <proxy>
+  Most services use the default scope, "singleton".  With this scope a <proxy>
   is created when the service is first referenced.  By reference, we mean any situation in which
   the service is requested by name, such as using the @InjectService annotation on a
   service builder method, or by using the
@@ -102,7 +102,7 @@
   In any case, the service proxy will only create the service implementation when a method
   on the service interface is invoked. Until then, the service can be thought of as "virtual".
   As the first method is invoked, the service builder method is invoked, then any service
-  decorations occur.  This construction process occurs only once.
+  decorations occur.  This construction process, called "realization", occurs only once.
   
   You should be aware when writing services that your code must be thread safe; any service
   you define could be invoked simulataneously by multiple threads. This is rarely an issue
@@ -112,7 +112,7 @@
   
 * perthread
 
-  The perthread service lifecycle exists primarily to help multi-threaded servlet applications,
+  The perthread service scope exists primarily to help multi-threaded servlet applications,
   though it has other applications.
   
   With perthread, the service proxy will delegate to a local service instance that is associated
@@ -142,7 +142,7 @@
   
 Eager Loading Services
 
-  Services are normally created only as needed (per the lifecycle discussion above).
+  Services are normally created only as needed (per the scope discussion above).
   
   This can be tweaked slightly; by adding the 
   {{{apidocs/org/apache/tapestry/ioc/annotations/EagerLoad.html}EagerLoad}} annotation to

Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/IntegrationTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/IntegrationTest.java?view=diff&rev=526045&r1=526044&r2=526045
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/IntegrationTest.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/IntegrationTest.java Thu Apr  5 21:05:34 2007
@@ -211,21 +211,21 @@
     }
 
     @Test
-    public void unknown_lifecycle()
+    public void unknown_scope()
     {
-        Registry r = buildRegistry(UnknownLifecycleModule.class);
+        Registry r = buildRegistry(UnknownScopeModule.class);
 
         try
         {
-            r.getService("UnknownLifecycle", Runnable.class);
+            r.getService("UnknownScope", Runnable.class);
             unreachable();
         }
         catch (Exception ex)
         {
             assertMessageContains(
                     ex,
-                    "Error building service proxy for service 'UnknownLifecycle'",
-                    "Unknown service lifecycle 'magic'");
+                    "Error building service proxy for service 'UnknownScope'",
+                    "Unknown service scope 'magic'");
         }
     }
 

Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/PerThreadModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/PerThreadModule.java?view=diff&rev=526045&r1=526044&r2=526045
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/PerThreadModule.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/PerThreadModule.java Thu Apr  5 21:05:34 2007
@@ -14,11 +14,11 @@
 
 package org.apache.tapestry.ioc;
 
-import org.apache.tapestry.ioc.annotations.Lifecycle;
+import org.apache.tapestry.ioc.annotations.Scope;
 
 public class PerThreadModule
 {
-    @Lifecycle("perthread")
+    @Scope("perthread")
     public StringHolder buildStringHolder()
     {
         return new StringHolderImpl();

Copied: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/UnknownScopeModule.java (from r516840, tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/UnknownLifecycleModule.java)
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/UnknownScopeModule.java?view=diff&rev=526045&p1=tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/UnknownLifecycleModule.java&r1=516840&p2=tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/UnknownScopeModule.java&r2=526045
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/UnknownLifecycleModule.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/UnknownScopeModule.java Thu Apr  5 21:05:34 2007
@@ -14,12 +14,12 @@
 
 package org.apache.tapestry.ioc;
 
-import org.apache.tapestry.ioc.annotations.Lifecycle;
+import org.apache.tapestry.ioc.annotations.Scope;
 
-public class UnknownLifecycleModule
+public class UnknownScopeModule
 {
-    @Lifecycle("magic")
-    public Runnable buildUnknownLifecycle()
+    @Scope("magic")
+    public Runnable buildUnknownScope()
     {
         return null;
     }

Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImplTest.java?view=diff&rev=526045&r1=526044&r2=526045
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImplTest.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImplTest.java Thu Apr  5 21:05:34 2007
@@ -78,7 +78,7 @@
         assertEquals(sd.getServiceInterface(), FieService.class);
 
         assertTrue(sd.toString().contains(className + ".buildFred()"));
-        assertEquals(sd.getServiceLifeycle(), IOCConstants.DEFAULT_LIFECYCLE);
+        assertEquals(sd.getServiceScope(), IOCConstants.DEFAULT_LIFECYCLE);
         assertEquals(sd.isEagerLoad(), false);
 
         sd = md.getServiceDef("Wilma");

Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/SimpleModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/SimpleModule.java?view=diff&rev=526045&r1=526044&r2=526045
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/SimpleModule.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/SimpleModule.java Thu Apr  5 21:05:34 2007
@@ -16,14 +16,14 @@
 
 import org.apache.tapestry.ioc.Configuration;
 import org.apache.tapestry.ioc.annotations.EagerLoad;
-import org.apache.tapestry.ioc.annotations.Lifecycle;
+import org.apache.tapestry.ioc.annotations.Scope;
 
 /**
  * Used by {@link org.apache.tapestry.ioc.internal.DefaultModuleDefImplTest}.
  */
 public class SimpleModule
 {
-    @Lifecycle("threaded")
+    @Scope("threaded")
     public FoeService buildBarney()
     {
         return null;

Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/AnnotatedBean.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/AnnotatedBean.java?view=diff&rev=526045&r1=526044&r2=526045
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/AnnotatedBean.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/AnnotatedBean.java Thu Apr  5 21:05:34 2007
@@ -14,7 +14,7 @@
 
 package org.apache.tapestry.ioc.internal.services;
 
-import org.apache.tapestry.ioc.annotations.Lifecycle;
+import org.apache.tapestry.ioc.annotations.Scope;
 
 public class AnnotatedBean
 {
@@ -32,18 +32,18 @@
         return null;
     }
 
-    @Lifecycle("onwrite")
+    @Scope("onwrite")
     public void setAnnotationOnWrite(String value)
     {
     }
 
-    @Lifecycle("onread")
+    @Scope("onread")
     public String getAnnotationOnRead()
     {
         return null;
     }
 
-    @Lifecycle("onwrite")
+    @Scope("onwrite")
     public void setAnnotationOnRead(String value)
     {
     }

Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/PropertyAccessImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/PropertyAccessImplTest.java?view=diff&rev=526045&r1=526044&r2=526045
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/PropertyAccessImplTest.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/PropertyAccessImplTest.java Thu Apr  5 21:05:34 2007
@@ -24,7 +24,7 @@
 import java.util.Random;
 
 import org.apache.tapestry.ioc.Registry;
-import org.apache.tapestry.ioc.annotations.Lifecycle;
+import org.apache.tapestry.ioc.annotations.Scope;
 import org.apache.tapestry.ioc.internal.IOCInternalTestCase;
 import org.apache.tapestry.ioc.services.ClassPropertyAdapter;
 import org.apache.tapestry.ioc.services.PropertyAccess;
@@ -431,7 +431,7 @@
         PropertyAdapter pa = _access.getAdapter(AnnotatedBean.class)
                 .getPropertyAdapter("readWrite");
 
-        assertNull(pa.getAnnotation(Lifecycle.class));
+        assertNull(pa.getAnnotation(Scope.class));
     }
 
     @Test
@@ -440,7 +440,7 @@
         PropertyAdapter pa = _access.getAdapter(AnnotatedBean.class).getPropertyAdapter(
                 "annotationOnWrite");
 
-        Lifecycle annotation = pa.getAnnotation(Lifecycle.class);
+        Scope annotation = pa.getAnnotation(Scope.class);
         assertNotNull(annotation);
 
         assertEquals(annotation.value(), "onwrite");
@@ -452,7 +452,7 @@
         PropertyAdapter pa = _access.getAdapter(AnnotatedBean.class).getPropertyAdapter(
                 "annotationOnRead");
 
-        Lifecycle annotation = pa.getAnnotation(Lifecycle.class);
+        Scope annotation = pa.getAnnotation(Scope.class);
         assertNotNull(annotation);
 
         assertEquals(annotation.value(), "onread");
@@ -463,6 +463,6 @@
     {
         PropertyAdapter pa = _access.getAdapter(AnnotatedBean.class).getPropertyAdapter("readOnly");
 
-        assertNull(pa.getAnnotation(Lifecycle.class));
+        assertNull(pa.getAnnotation(Scope.class));
     }
 }