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 2010/09/04 01:18:08 UTC

svn commit: r992503 - in /tapestry/tapestry5/trunk: tapestry-core/src/main/java/org/apache/tapestry5/services/ApplicationStateManager.java tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/ObjectLocator.java

Author: hlship
Date: Fri Sep  3 23:18:08 2010
New Revision: 992503

URL: http://svn.apache.org/viewvc?rev=992503&view=rev
Log:
TAP5-1123: Documentation in ApplicationStateManager is not quite correct: when creating an SSO it uses the full injection machinery, not necessarilly the no-args constructor

Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ApplicationStateManager.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/ObjectLocator.java

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ApplicationStateManager.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ApplicationStateManager.java?rev=992503&r1=992502&r2=992503&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ApplicationStateManager.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ApplicationStateManager.java Fri Sep  3 23:18:08 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,6 +14,7 @@
 
 package org.apache.tapestry5.services;
 
+import org.apache.tapestry5.ioc.ObjectLocator;
 import org.apache.tapestry5.ioc.annotations.UsesMappedConfiguration;
 
 /**
@@ -22,12 +23,13 @@ import org.apache.tapestry5.ioc.annotati
  * they are specific to a particular client.
  * <p/>
  * The term "Application" is a hold-over from Tapestry 5.0, which used the {@link ApplicationState} annotation, and
- * called them "ASOs" (Application State Objects).
+ * called them "ASOs" (Application State Objects). This service would be better named "SessionStateManager" (but
+ * renaming it would cause backwards compatibility issues).
  * <p/>
  * Tapestry has a built-in default strategy for storing SSOs (in the session) and instantiating them. If desired,
  * contributions to the service configuration can override the default behavior, either specifying an alternate storage
  * strategy, or an alternate {@linkplain org.apache.tapestry5.services.ApplicationStateCreator creation strategy}.
- *
+ * 
  * @see org.apache.tapestry5.annotations.ApplicationState
  */
 @UsesMappedConfiguration(key = Class.class, value = ApplicationStateContribution.class)
@@ -35,11 +37,14 @@ public interface ApplicationStateManager
 {
     /**
      * For a given class, find the SSO for the class, creating it if necessary. The manager has a configuration that
-     * determines how an instance is stored and created as needed. A requested SSO not in the configuration is assumed
-     * to be created via a no-args constructor, and stored in the session.
-     *
+     * determines how an instance is stored and created as needed. The default (when there is no configuration for
+     * a SSO type) is to instantiate the object with injected dependencies, via {@link ObjectLocator#autobuild(Class)}.
+     * This
+     * allows an SSO to keep references to Tapestry IoC services or other objects that can be injected.
+     * 
      * @param <T>
-     * @param ssoClass identifies the SSO to access or create
+     * @param ssoClass
+     *            identifies the SSO to access or create
      * @return the SSO instance
      */
     <T> T get(Class<T> ssoClass);
@@ -47,17 +52,19 @@ public interface ApplicationStateManager
     /**
      * For a given class, find the SSO for the class. The manager has a configuration that determines how an instance is
      * stored.
-     *
+     * 
      * @param <T>
-     * @param ssoClass identifies the SSO to access or create
+     * @param ssoClass
+     *            identifies the SSO to access or create
      * @return the SSO instance or null if it does not already exist
      */
     <T> T getIfExists(Class<T> ssoClass);
 
     /**
      * Returns true if the SSO already exists, false if it has not yet been created.
-     *
-     * @param ssoClass used to select the SSO
+     * 
+     * @param ssoClass
+     *            used to select the SSO
      * @return true if SSO exists, false if null
      */
     <T> boolean exists(Class<T> ssoClass);
@@ -65,10 +72,12 @@ public interface ApplicationStateManager
     /**
      * Stores a new SSO, replacing the existing SSO (if any). Storing the value null will delete the SSO so that it may
      * be re-created later.
-     *
+     * 
      * @param <T>
-     * @param ssoClass the type of SSO
-     * @param SSO      the SSO instance
+     * @param ssoClass
+     *            the type of SSO
+     * @param SSO
+     *            the SSO instance
      */
     <T> void set(Class<T> ssoClass, T SSO);
 }

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/ObjectLocator.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/ObjectLocator.java?rev=992503&r1=992502&r2=992503&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/ObjectLocator.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/ObjectLocator.java Fri Sep  3 23:18:08 2010
@@ -84,7 +84,7 @@ public interface ObjectLocator
 
     /**
      * Autobuilds a class by finding the public constructor with the most parameters. Services and other resources or
-     * dependencies will be injected into the parameters of the constructor and private field marked with the
+     * dependencies will be injected into the parameters of the constructor and into private fields marked with the
      * {@link Inject} annotation. There are two cases: constructing a service implementation, and constructing
      * an arbitrary object. In the former case, many <em>service resources</em> are also available for injection, not
      * just dependencies or objects provided via