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/03/30 00:45:44 UTC

svn commit: r523862 [1/4] - in /tapestry/tapestry5: quickstart/trunk/src/main/resources/archetype-resources/ tapestry-component-report/trunk/ tapestry-core/trunk/src/main/java/org/apache/tapestry/ tapestry-core/trunk/src/main/java/org/apache/tapestry/a...

Author: hlship
Date: Thu Mar 29 15:45:36 2007
New Revision: 523862

URL: http://svn.apache.org/viewvc?view=rev&rev=523862
Log:
TAPESTRY-1387: @Inject should expose annotations on the field to the ObjectProvider

Added:
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/annotations/Id.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/annotations/Path.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/annotations/Service.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/AssetInjectionProvider.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InjectResourcesWorker.java
      - copied, changed from r519727, tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InjectAnonymousWorker.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InjectWorker.java
      - copied, changed from r519727, tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InjectNamedWorker.java
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/AssetInjectionProviderTest.java
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/InjectResourcesWorkerTest.java
      - copied, changed from r519727, tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/InjectAnonymousWorkerTest.java
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/InjectWorkerTest.java
      - copied, changed from r519727, tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/InjectNamedWorkerTest.java
    tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/AnnotationProvider.java
      - copied, changed from r519727, tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/AnnotationProvider.java
    tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/annotations/Value.java
    tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/NullAnnotationProvider.java
    tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/services/ValueObjectProvider.java
    tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/ValueObjectProviderTest.java
    tapestry/tapestry5/tapestry-spring/trunk/src/main/java/org/apache/tapestry/spring/SpringBean.java
    tapestry/tapestry5/tapestry-spring/trunk/src/test/java/org/apache/tapestry/spring/SampleBean.java
      - copied, changed from r515167, tapestry/tapestry5/tapestry-spring/trunk/src/test/java/org/apache/tapestry/spring/SpringBean.java
Removed:
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/AnnotationProvider.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/DefaultInjectionProvider.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InjectAnonymousWorker.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InjectAssetWorker.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InjectNamedWorker.java
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/InjectAnonymousWorkerTest.java
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/InjectAssetWorkerTest.java
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/InjectNamedWorkerTest.java
    tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/services/MasterObjectProvider.java
    tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/services/ServiceObjectProvider.java
    tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/IndirectionModule.java
    tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/InjectLiteralModule.java
    tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/MasterObjectProviderTest.java
    tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/ServiceObjectProviderTest.java
    tapestry/tapestry5/tapestry-spring/trunk/src/test/java/org/apache/tapestry/spring/SpringBean.java
Modified:
    tapestry/tapestry5/quickstart/trunk/src/main/resources/archetype-resources/pom.xml
    tapestry/tapestry5/tapestry-component-report/trunk/pom.xml
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/Binding.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ComponentResources.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/PropertyConduit.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/annotations/Inject.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/base/AbstractField.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/base/AbstractTextField.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/BeanEditForm.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/Form.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/Grid.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/GridColumns.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/Output.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/OutputRaw.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/RenderObject.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/Select.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/pages/ExceptionReport.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/beaneditor/PrimitiveFieldConstraintGenerator.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/beaneditor/ValidateAnnotationConstraintGenerator.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/AliasImpl.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/AliasManagerImpl.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/AssetObjectProvider.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/AssetSourceImpl.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/BasePropertyConduit.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/FieldValidatorDefaultSourceImpl.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InjectBlockWorker.java
    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/internal/services/PageRenderSupportImpl.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/PropertyConduitSourceImpl.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/ServicesMessages.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/ValidationConstraintGeneratorImpl.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/structure/InternalComponentResourcesImpl.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/test/InternalBaseTestCase.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/Alias.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/AliasContribution.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/AliasManager.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/AssetSource.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/ClassTransformation.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/FieldValidatorDefaultSource.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/TapestryModule.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/ValidationConstraintGenerator.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/test/TapestryTestCase.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/test/pagelevel/PageTester.java
    tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/internal/services/ServicesStrings.properties
    tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/alias.apt
    tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/assets.apt
    tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/inject.apt
    tapestry/tapestry5/tapestry-core/trunk/src/site/apt/index.apt
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/components/RenderableProvider.java
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/pages/AssetDemo.java
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/pages/InjectDemo.java
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/pages/Localization.java
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/services/MusicLibraryParser.java
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app2/SimpleASO.java
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app2/pages/TestPageForAsset.java
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/AliasImplTest.java
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/AliasManagerImplTest.java
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/AssetObjectProviderTest.java
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/BeanModelSourceImplTest.java
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/ComponentEventImplTest.java
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/FieldValidatorDefaultSourceImplTest.java
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/InjectBlockWorkerTest.java
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/LinkFactoryImplTest.java
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/PageRenderSupportImplTest.java
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/PropertyConduitSourceImplTest.java
    tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/services/AliasContributionTest.java
    tapestry/tapestry5/tapestry-core/trunk/src/test/resources/log4j.properties
    tapestry/tapestry5/tapestry-hibernate/trunk/src/main/java/org/apache/tapestry/hibernate/HibernateModule.java
    tapestry/tapestry5/tapestry-hibernate/trunk/src/test/conf/testng.xml
    tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/ObjectProvider.java
    tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/ServiceLocator.java
    tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/annotations/Inject.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/InternalRegistry.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/RegistryWrapper.java
    tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/ServiceLocatorImpl.java
    tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/util/InternalUtils.java
    tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/services/TapestryIOCModule.java
    tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/test/IOCTestCase.java
    tapestry/tapestry5/tapestry-ioc/trunk/src/site/apt/coerce.apt
    tapestry/tapestry5/tapestry-ioc/trunk/src/site/apt/command.apt
    tapestry/tapestry5/tapestry-ioc/trunk/src/site/apt/decorator.apt
    tapestry/tapestry5/tapestry-ioc/trunk/src/site/apt/module.apt
    tapestry/tapestry5/tapestry-ioc/trunk/src/site/apt/provider.apt
    tapestry/tapestry5/tapestry-ioc/trunk/src/site/apt/run.apt
    tapestry/tapestry5/tapestry-ioc/trunk/src/site/apt/service.apt
    tapestry/tapestry5/tapestry-ioc/trunk/src/site/apt/shadow.apt
    tapestry/tapestry5/tapestry-ioc/trunk/src/site/apt/symbols.apt
    tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/IntegrationTest.java
    tapestry/tapestry5/tapestry-project/trunk/pom.xml
    tapestry/tapestry5/tapestry-project/trunk/src/site/apt/index.apt
    tapestry/tapestry5/tapestry-spring/trunk/src/main/java/org/apache/tapestry/spring/SpringModule.java
    tapestry/tapestry5/tapestry-spring/trunk/src/main/java/org/apache/tapestry/spring/SpringObjectProvider.java
    tapestry/tapestry5/tapestry-spring/trunk/src/site/apt/index.apt
    tapestry/tapestry5/tapestry-spring/trunk/src/test/java/org/apache/tapestry/spring/SpringObjectProviderTest.java
    tapestry/tapestry5/tapestry-spring/trunk/src/test/java/org/example/testapp/pages/Start.java

Modified: tapestry/tapestry5/quickstart/trunk/src/main/resources/archetype-resources/pom.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/quickstart/trunk/src/main/resources/archetype-resources/pom.xml?view=diff&rev=523862&r1=523861&r2=523862
==============================================================================
--- tapestry/tapestry5/quickstart/trunk/src/main/resources/archetype-resources/pom.xml (original)
+++ tapestry/tapestry5/quickstart/trunk/src/main/resources/archetype-resources/pom.xml Thu Mar 29 15:45:36 2007
@@ -97,8 +97,8 @@
 
   <repositories>
     <repository>
-      <id>apache.snapshots</id>
-      <url>http://people.apache.org/repo/m2-snapshot-repository/</url>
+      <id>tapestry-snapshots</id>
+      <url>http://people.apache.org/~hlship/tapestry-snapshot-repository/</url>
     </repository>
     <repository>
       <id>codehaus.snapshots</id>
@@ -114,8 +114,8 @@
   
   <pluginRepositories>
     <pluginRepository>
-      <id>apache.snapshots</id>
-      <url>http://people.apache.org/repo/m2-snapshot-repository/</url>
+      <id>tapestry-snapshots</id>
+      <url>http://people.apache.org/~hlship/tapestry-snapshot-repository/</url>
     </pluginRepository>
     <!-- A necessary version of the surefire plugin, 2.8-SNAPSHOT, lives here. -->
     <pluginRepository>
@@ -126,6 +126,6 @@
   
 
     <properties>
-        <tapestry-release-version>5.0.3</tapestry-release-version>
+        <tapestry-release-version>5.0.4-SNAPSHOT</tapestry-release-version>
     </properties>
 </project>

Modified: tapestry/tapestry5/tapestry-component-report/trunk/pom.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-component-report/trunk/pom.xml?view=diff&rev=523862&r1=523861&r2=523862
==============================================================================
--- tapestry/tapestry5/tapestry-component-report/trunk/pom.xml (original)
+++ tapestry/tapestry5/tapestry-component-report/trunk/pom.xml Thu Mar 29 15:45:36 2007
@@ -140,4 +140,12 @@
       </dependencies>
     </profile>
   </profiles>
+
+  <!-- Temporary: until we figure out what needs org.apache.maven.plugins:maven-plugins:pom:2-SNAPSHOT -->
+  <pluginRepositories>
+    <pluginRepository>
+      <id>apache-snapshots</id>
+      <url>http://people.apache.org/repo/m2-snapshot-repository/</url>
+    </pluginRepository>
+  </pluginRepositories>
 </project>

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/Binding.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/Binding.java?view=diff&rev=523862&r1=523861&r2=523862
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/Binding.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/Binding.java Thu Mar 29 15:45:36 2007
@@ -14,6 +14,8 @@
 
 package org.apache.tapestry;
 
+import org.apache.tapestry.ioc.AnnotationProvider;
+
 /**
  * A binding is a connection between a component and its container (another component), that allows
  * the embedded component to gain access to <em>resources</em> defined by the container. Resources

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ComponentResources.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ComponentResources.java?view=diff&rev=523862&r1=523861&r2=523862
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ComponentResources.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/ComponentResources.java Thu Mar 29 15:45:36 2007
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 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.
@@ -14,7 +14,9 @@
 
 package org.apache.tapestry;
 
+import org.apache.tapestry.ioc.AnnotationProvider;
 import org.apache.tapestry.ioc.Messages;
+import org.apache.tapestry.ioc.Resource;
 import org.apache.tapestry.model.ComponentModel;
 import org.apache.tapestry.runtime.Component;
 
@@ -27,6 +29,12 @@
  */
 public interface ComponentResources extends ComponentResourcesCommon
 {
+    /**
+     * Returns the base resource for the component, which will represent the class's location within
+     * the classpath (this is used to resolve relative assets).
+     */
+    Resource getBaseResource();
+
     /** Returns the component model object that defines the behavior of the component. */
     ComponentModel getComponentModel();
 

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/PropertyConduit.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/PropertyConduit.java?view=diff&rev=523862&r1=523861&r2=523862
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/PropertyConduit.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/PropertyConduit.java Thu Mar 29 15:45:36 2007
@@ -14,6 +14,8 @@
 
 package org.apache.tapestry;
 
+import org.apache.tapestry.ioc.AnnotationProvider;
+
 /**
  * Used to read or update the value associated with a property. A PropertyConduit provides access to
  * the annotations on the underlying getter and/or setter methods.

Added: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/annotations/Id.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/annotations/Id.java?view=auto&rev=523862
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/annotations/Id.java (added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/annotations/Id.java Thu Mar 29 15:45:36 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.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+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.Block;
+
+/**
+ * Optional annotation, used with {@link Inject}, which exists to provide the id of an object when
+ * it can not be determined by other means (such as from the field name). Currently, this is used
+ * when injecting a {@link Block}.
+ */
+@Target(FIELD)
+@Documented
+@Retention(RUNTIME)
+public @interface Id
+{
+    /** The id. */
+    String value();
+}

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/annotations/Inject.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/annotations/Inject.java?view=diff&rev=523862&r1=523861&r2=523862
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/annotations/Inject.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/annotations/Inject.java Thu Mar 29 15:45:36 2007
@@ -21,50 +21,21 @@
 import java.lang.annotation.Retention;
 import java.lang.annotation.Target;
 
-import org.apache.commons.logging.Log;
-import org.apache.tapestry.Asset;
-import org.apache.tapestry.Block;
 import org.apache.tapestry.ComponentResources;
-import org.apache.tapestry.ioc.Messages;
+import org.apache.tapestry.ioc.ObjectProvider;
 
 /**
- * Allows injection of various objects into a component class. In certain cases, the type of the
- * field guides the interpretation of the value. For {@link Asset}, the value is the path, relative
- * to the component's class file, to the resource from which the Asset is obtained.
- * <p>
- * In most other cases, the value is an object reference. A common example:
+ * Allows injection of various objects into a component class. for certain cases, the type dictates
+ * a particular property from {@link ComponentResources} is injected, but in most cases it works
+ * like the {@link org.apache.tapestry.ioc.annotations.Inject} annotation used by the IoC container.
  * 
- * <pre>
- * @Inject(&quot;alias:Request&quot;)
- * private Request _request;
- * </pre>
- * 
- * <p>
- * There is a complex relationship between the type of the field and the interpretation of the
- * annotation and its value.
- * <p>
- * For type {@link Asset}, the value is a relative path to the asset.
- * <p>
- * For type {@link Block}, the value is the id of a block in the component's template. When the
- * value is omitted, it is deduced from the field name.
- * <p>
- * Finally, for certain specific types, the value is omitted entirely, and an object appropriate to
- * the component instance is injected. This includes {@link ComponentResources}, Locale (for the
- * containing page's locale), {@link Messages} (the component's message catalog), {@link Log} to log
- * errors or debugging data, and String for the component's complete id.
- * <p>
- * And if nothing else matches and the value is omitted, then a search for Tapestry IOC service
- * implementing the interface defined by the fields type occurs.
  * @see org.apache.tapestry.services.InjectionProvider
+ * @see ObjectProvider
  */
 @Target(FIELD)
 @Documented
 @Retention(RUNTIME)
-public @interface Inject {
+public @interface Inject
+{
 
-    /**
-     * Identifies the value to be injected, when the type by itself is insufficient. Omitted in many
-     * cases.
-     */
-    String value() default "";
 }

Added: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/annotations/Path.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/annotations/Path.java?view=auto&rev=523862
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/annotations/Path.java (added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/annotations/Path.java Thu Mar 29 15:45:36 2007
@@ -0,0 +1,45 @@
+// 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.annotations;
+
+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.Asset;
+
+/**
+ * Used in conjunction with the {@link Inject} annotation to inject an {@link Asset} based on a
+ * path.
+ */
+@Target(
+{ FIELD, PARAMETER })
+@Documented
+@Retention(RUNTIME)
+public @interface Path
+{
+    /**
+     * The path to the resource; if prefixed (say with "classpath:") then its a complete path within
+     * the identified namespace; otherwise it's a relative path from the class containing the
+     * annotation. Symbols will be expanded.
+     * 
+     * @return
+     */
+    String value();
+}

Added: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/annotations/Service.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/annotations/Service.java?view=auto&rev=523862
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/annotations/Service.java (added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/annotations/Service.java Thu Mar 29 15:45:36 2007
@@ -0,0 +1,39 @@
+// 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.annotations;
+
+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 in conjunction with the {@link Inject} annotation (or the IoC container's
+ * {@link org.apache.tapestry.ioc.annotations.Inject} annotation) to identify a service
+ * <em>by name</em> and not by type (which is more typical). This is most useful when there are
+ * multiple services with the same service interface and a particular one needs to be selected.
+ */
+@Target(
+{ FIELD, PARAMETER })
+@Documented
+@Retention(RUNTIME)
+public @interface Service
+{
+    /** The name of the service. Symbols will be expanded and case is not relevant. */
+    String value();
+}

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/base/AbstractField.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/base/AbstractField.java?view=diff&rev=523862&r1=523861&r2=523862
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/base/AbstractField.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/base/AbstractField.java Thu Mar 29 15:45:36 2007
@@ -142,7 +142,7 @@
     @Inject
     private ComponentResources _resources;
 
-    @Inject("alias:DefaultComponentParameterBindingSource")
+    @Inject
     private DefaultComponentParameterBindingSource _defaultBindingSource;
 
     final String defaultLabel()
@@ -207,8 +207,7 @@
 
     private void processSubmission()
     {
-        if (!_disabled)
-            processSubmission(_formSupport, _elementName);
+        if (!_disabled) processSubmission(_formSupport, _elementName);
     }
 
     /**

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/base/AbstractTextField.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/base/AbstractTextField.java?view=diff&rev=523862&r1=523861&r2=523862
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/base/AbstractTextField.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/base/AbstractTextField.java Thu Mar 29 15:45:36 2007
@@ -69,13 +69,13 @@
     @Environmental
     private ValidationTracker _tracker;
 
-    @Inject("alias:ValidationMessagesSource")
+    @Inject
     private ValidationMessagesSource _messagesSource;
 
-    @Inject("alias:TranslatorDefaultSource")
+    @Inject
     private TranslatorDefaultSource _translatorDefaultSource;
 
-    @Inject("alias:FieldValidatorDefaultSource")
+    @Inject
     private FieldValidatorDefaultSource _fieldValidatorDefaultSource;
 
     @Inject
@@ -94,8 +94,7 @@
 
         Class type = _resources.getBoundType("value");
 
-        if (type == null)
-            return null;
+        if (type == null) return null;
 
         return _translatorDefaultSource.find(type);
     }
@@ -108,8 +107,7 @@
     {
         Class type = _resources.getBoundType("value");
 
-        if (type == null)
-            return null;
+        if (type == null) return null;
 
         return _fieldValidatorDefaultSource.createDefaultValidator(
                 this,
@@ -134,11 +132,10 @@
     {
         String value = _tracker.getInput(this);
 
-        if (value == null)
-            value = _translate.toClient(_value);
+        if (value == null) value = _translate.toClient(_value);
 
         writeFieldTag(writer, value);
-        
+
         _validate.render(writer);
 
         getValidationDecorator().insideField(this);

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/BeanEditForm.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/BeanEditForm.java?view=diff&rev=523862&r1=523861&r2=523862
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/BeanEditForm.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/BeanEditForm.java Thu Mar 29 15:45:36 2007
@@ -79,13 +79,13 @@
     @Inject
     private ComponentResources _resources;
 
-    @Inject("alias:BeanModelSource")
+    @Inject
     private BeanModelSource _modelSource;
 
-    @Inject("alias:TranslatorDefaultSource")
+    @Inject
     private TranslatorDefaultSource _translatorDefaultSource;
 
-    @Inject("alias:FieldValidatorDefaultSource")
+    @Inject
     private FieldValidatorDefaultSource _fieldValidatorDefaultSource;
 
     @Inject

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/Form.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/Form.java?view=diff&rev=523862&r1=523861&r2=523862
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/Form.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/Form.java Thu Mar 29 15:45:36 2007
@@ -37,6 +37,7 @@
 import org.apache.tapestry.annotations.Inject;
 import org.apache.tapestry.annotations.Mixin;
 import org.apache.tapestry.annotations.Parameter;
+import org.apache.tapestry.annotations.Path;
 import org.apache.tapestry.annotations.Persist;
 import org.apache.tapestry.corelib.mixins.RenderInformals;
 import org.apache.tapestry.dom.Element;
@@ -138,7 +139,7 @@
     @Parameter("true")
     private boolean _clientValidation;
 
-    @Inject("alias:Environment")
+    @Inject
     private Environment _environment;
 
     @Inject
@@ -147,10 +148,10 @@
     @Environmental
     private PageRenderSupport _pageRenderSupport;
 
-    @Inject("service:FormParameterLookup")
+    @Inject
     private FormParameterLookup _paramLookup;
 
-    @Inject("alias:ComponentSource")
+    @Inject
     private ComponentSource _source;
 
     @Persist
@@ -160,13 +161,16 @@
 
     private Element _div;
 
-    @Inject("${tapestry.scriptaculous}/prototype.js")
+    @Inject
+    @Path("${tapestry.scriptaculous}/prototype.js")
     private Asset _prototype;
 
-    @Inject("${tapestry.scriptaculous}/scriptaculous.js")
+    @Inject
+    @Path("${tapestry.scriptaculous}/scriptaculous.js")
     private Asset _scriptaculous;
 
-    @Inject("classpath:/org/apache/tapestry/tapestry.js")
+    @Inject
+    @Path("classpath:/org/apache/tapestry/tapestry.js")
     private Asset _tapestry;
 
     // Collects a stream of component actions. Each action goes in as a UTF string (the component
@@ -279,7 +283,7 @@
         _tracker = _environment.pop(ValidationTracker.class);
     }
 
-    @Inject("alias:ComponentEventResultProcessor")
+    @Inject
     private ComponentEventResultProcessor _eventResultProcessor;
 
     private String _name;

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/Grid.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/Grid.java?view=diff&rev=523862&r1=523861&r2=523862
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/Grid.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/Grid.java Thu Mar 29 15:45:36 2007
@@ -104,10 +104,10 @@
     @Inject
     private ComponentResources _resources;
 
-    @Inject("alias:BeanModelSource")
+    @Inject
     private BeanModelSource _modelSource;
 
-    @Inject("alias:TypeCoercer")
+    @Inject
     private TypeCoercer _typeCoercer;
 
     // Transformed version of the source parameter.
@@ -187,8 +187,7 @@
 
         int availableRows = _dataSource.getAvailableRows();
 
-        if (availableRows == 0)
-            return _empty;
+        if (availableRows == 0) return _empty;
 
         PropertyModel sortModel = null;
 
@@ -219,8 +218,7 @@
         // Skip rendering of component (template, body, etc.) when there's nothing to display.
         // The empty placeholder will already have rendered.
 
-        if (_dataSource.getAvailableRows() == 0)
-            return false;
+        if (_dataSource.getAvailableRows() == 0) return false;
 
         return null;
     }

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/GridColumns.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/GridColumns.java?view=diff&rev=523862&r1=523861&r2=523862
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/GridColumns.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/GridColumns.java Thu Mar 29 15:45:36 2007
@@ -21,6 +21,7 @@
 import org.apache.tapestry.annotations.Inject;
 import org.apache.tapestry.annotations.OnEvent;
 import org.apache.tapestry.annotations.Parameter;
+import org.apache.tapestry.annotations.Path;
 import org.apache.tapestry.beaneditor.PropertyModel;
 import org.apache.tapestry.grid.GridModelProvider;
 import org.apache.tapestry.ioc.Messages;
@@ -57,10 +58,10 @@
     { "disabled=sortDisabled", "context=columnModel.id", "class=sortLinkClass" })
     private ActionLink _sort, _sort2;
 
-    @Inject("sort-asc.png")
+    @Inject @Path("sort-asc.png")
     private Asset _ascendingAsset;
 
-    @Inject("sort-desc.png")
+    @Inject @Path("sort-desc.png")
     private Asset _descendingAsset;
     
     @Inject

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/Output.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/Output.java?view=diff&rev=523862&r1=523861&r2=523862
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/Output.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/Output.java Thu Mar 29 15:45:36 2007
@@ -51,7 +51,7 @@
     @Parameter("componentResources.elementName")
     private String _elementName;
 
-    @Inject("alias:DefaultComponentParameterBindingSource")
+    @Inject
     private DefaultComponentParameterBindingSource _defaultBindingSource;
 
     @Inject

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/OutputRaw.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/OutputRaw.java?view=diff&rev=523862&r1=523861&r2=523862
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/OutputRaw.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/OutputRaw.java Thu Mar 29 15:45:36 2007
@@ -37,7 +37,7 @@
     @Parameter(required = true)
     private String _value;
 
-    @Inject("alias:DefaultComponentParameterBindingSource")
+    @Inject
     private DefaultComponentParameterBindingSource _defaultBindingSource;
 
     @Inject
@@ -50,8 +50,7 @@
 
     boolean beginRender(MarkupWriter writer)
     {
-        if (_value != null && _value.length() > 0)
-            writer.writeRaw(_value);
+        if (_value != null && _value.length() > 0) writer.writeRaw(_value);
 
         // Abort the rest of the render.
 

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/RenderObject.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/RenderObject.java?view=diff&rev=523862&r1=523861&r2=523862
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/RenderObject.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/RenderObject.java Thu Mar 29 15:45:36 2007
@@ -29,7 +29,7 @@
     @Parameter(required = true)
     private Object _object;
 
-    @Inject("alias:ObjectRenderer")
+    @Inject
     private ObjectRenderer<Object> _renderer;
 
     boolean beginRender(MarkupWriter writer)

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/Select.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/Select.java?view=diff&rev=523862&r1=523861&r2=523862
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/Select.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/components/Select.java Thu Mar 29 15:45:36 2007
@@ -83,7 +83,7 @@
     @SuppressWarnings("unchecked")
     private FieldValidator<Object> _validate = NOOP_VALIDATOR;
 
-    @Inject("alias:FieldValidatorDefaultSource")
+    @Inject
     private FieldValidatorDefaultSource _fieldValidatorDefaultSource;
 
     @Environmental
@@ -108,8 +108,7 @@
     {
         Class type = _resources.getBoundType("value");
 
-        if (type == null)
-            return null;
+        if (type == null) return null;
 
         return _fieldValidatorDefaultSource.createDefaultValidator(
                 this,
@@ -125,11 +124,9 @@
     {
         Class valueType = _resources.getBoundType("value");
 
-        if (valueType == null)
-            return null;
+        if (valueType == null) return null;
 
-        if (Enum.class.isAssignableFrom(valueType))
-            return new EnumValueEncoder(valueType);
+        if (Enum.class.isAssignableFrom(valueType)) return new EnumValueEncoder(valueType);
 
         return null;
     }
@@ -139,8 +136,7 @@
     {
         Class valueType = _resources.getBoundType("value");
 
-        if (valueType == null)
-            return null;
+        if (valueType == null) return null;
 
         if (Enum.class.isAssignableFrom(valueType))
             return new EnumSelectModel(valueType, _resources.getContainerMessages());
@@ -184,8 +180,7 @@
     @SuppressWarnings("unchecked")
     private void writeOptions(MarkupWriter writer, List<OptionModel> optionModels)
     {
-        if (optionModels == null)
-            return;
+        if (optionModels == null) return;
 
         for (OptionModel model : optionModels)
         {
@@ -195,8 +190,7 @@
 
             writer.element("option", "value", clientValue);
 
-            if (isOptionValueSelected(optionValue))
-                writer.attributes("selected", "selected");
+            if (isOptionValueSelected(optionValue)) writer.attributes("selected", "selected");
 
             writeDisabled(writer, model.isDisabled());
             writeAttributes(writer, model.getAttributes());
@@ -214,14 +208,12 @@
 
     private void writeDisabled(MarkupWriter writer, boolean disabled)
     {
-        if (disabled)
-            writer.attributes("disabled", "disabled");
+        if (disabled) writer.attributes("disabled", "disabled");
     }
 
     private void writeAttributes(MarkupWriter writer, Map<String, String> attributes)
     {
-        if (attributes == null)
-            return;
+        if (attributes == null) return;
 
         for (Map.Entry<String, String> e : attributes.entrySet())
             writer.attributes(e.getKey(), e.getValue());

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/pages/ExceptionReport.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/pages/ExceptionReport.java?view=diff&rev=523862&r1=523861&r2=523862
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/pages/ExceptionReport.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/pages/ExceptionReport.java Thu Mar 29 15:45:36 2007
@@ -40,10 +40,10 @@
 
     private String _attributeName;
 
-    @Inject("service:ExceptionAnalyzer")
+    @Inject
     private ExceptionAnalyzer _analyzer;
 
-    @Inject("alias:Request")
+    @Inject
     private Request _request;
 
     public void reportException(Throwable exception)

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/beaneditor/PrimitiveFieldConstraintGenerator.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/beaneditor/PrimitiveFieldConstraintGenerator.java?view=diff&rev=523862&r1=523861&r2=523862
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/beaneditor/PrimitiveFieldConstraintGenerator.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/beaneditor/PrimitiveFieldConstraintGenerator.java Thu Mar 29 15:45:36 2007
@@ -17,7 +17,7 @@
 import java.util.Arrays;
 import java.util.List;
 
-import org.apache.tapestry.AnnotationProvider;
+import org.apache.tapestry.ioc.AnnotationProvider;
 import org.apache.tapestry.services.ValidationConstraintGenerator;
 
 /**

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/beaneditor/ValidateAnnotationConstraintGenerator.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/beaneditor/ValidateAnnotationConstraintGenerator.java?view=diff&rev=523862&r1=523861&r2=523862
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/beaneditor/ValidateAnnotationConstraintGenerator.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/beaneditor/ValidateAnnotationConstraintGenerator.java Thu Mar 29 15:45:36 2007
@@ -17,8 +17,8 @@
 import java.util.Arrays;
 import java.util.List;
 
-import org.apache.tapestry.AnnotationProvider;
 import org.apache.tapestry.beaneditor.Validate;
+import org.apache.tapestry.ioc.AnnotationProvider;
 import org.apache.tapestry.services.ValidationConstraintGenerator;
 
 /**

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/AliasImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/AliasImpl.java?view=diff&rev=523862&r1=523861&r2=523862
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/AliasImpl.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/AliasImpl.java Thu Mar 29 15:45:36 2007
@@ -14,11 +14,12 @@
 
 package org.apache.tapestry.internal.services;
 
-import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newCaseInsensitiveMap;
+import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newMap;
 import static org.apache.tapestry.ioc.internal.util.Defense.notNull;
 
 import java.util.Map;
 
+import org.apache.tapestry.ioc.AnnotationProvider;
 import org.apache.tapestry.ioc.ObjectProvider;
 import org.apache.tapestry.ioc.ServiceLocator;
 import org.apache.tapestry.ioc.internal.util.OneShotLock;
@@ -29,7 +30,9 @@
 {
     // Derived from the managers when first needed
 
-    private final Map<String, Object> _properties = newCaseInsensitiveMap();
+    private final Map<Class, Object> _properties = newMap();
+
+    private boolean _initialized = false;
 
     private AliasManager _masterManager;
 
@@ -66,31 +69,22 @@
 
         _masterManager = null;
         _overridesManager = null;
+
+        _initialized = true;
     }
 
-    public <T> T provide(String expression, Class<T> objectType, ServiceLocator locator)
+    public <T> T provide(Class<T> objectType, AnnotationProvider annotationProvider,
+            ServiceLocator locator)
     {
-        if (_properties.isEmpty())
-            throw new RuntimeException(ServicesMessages.aliasModeNotSet());
+        if (!_initialized) throw new RuntimeException(ServicesMessages.aliasModeNotSet());
 
-        Object object = _properties.get(expression);
+        Object object = _properties.get(objectType);
 
-        if (object == null)
-            throw new RuntimeException(ServicesMessages.aliasPropertyNotFound(
-                    expression,
-                    _properties.keySet()));
-
-        try
-        {
-            return objectType.cast(object);
-        }
-        catch (ClassCastException ex)
-        {
-            throw new RuntimeException(ServicesMessages.aliasPropertyWrongType(
-                    expression,
-                    object,
-                    objectType), ex);
-        }
-    }
+        // Let another provider handle this (probably the default object provider)
+        if (object == null) return null;
 
+        // A ClassCastException should never occur.
+
+        return objectType.cast(object);
+    }
 }

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/AliasManagerImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/AliasManagerImpl.java?view=diff&rev=523862&r1=523861&r2=523862
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/AliasManagerImpl.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/AliasManagerImpl.java Thu Mar 29 15:45:36 2007
@@ -14,7 +14,7 @@
 
 package org.apache.tapestry.internal.services;
 
-import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newCaseInsensitiveMap;
+import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newMap;
 
 import java.util.Collection;
 import java.util.Map;
@@ -35,10 +35,10 @@
         _contributions = contributions;
     }
 
-    public Map<String, Object> getAliasesForMode(String mode)
+    public Map<Class, Object> getAliasesForMode(String mode)
     {
-        Map<String, Object> general = buildMapForMode("");
-        Map<String, Object> specific = buildMapForMode(mode);
+        Map<Class, Object> general = buildMapForMode("");
+        Map<Class, Object> specific = buildMapForMode(mode);
 
         // Anything in specific overrides anything in general
 
@@ -47,26 +47,28 @@
         return general;
     }
 
-    private Map<String, Object> buildMapForMode(String mode)
+    private Map<Class, Object> buildMapForMode(String mode)
     {
-        Map<String, Object> result = newCaseInsensitiveMap();
+        Map<Class, Object> result = newMap();
 
         for (AliasContribution ic : _contributions)
         {
-            if (!ic.getMode().equals(mode))
-                continue;
+            if (!ic.getMode().equalsIgnoreCase(mode)) continue;
 
-            String name = ic.getName();
+            Class contributionType = ic.getContributionType();
 
-            Object existing = result.get(name);
+            Object existing = result.get(contributionType);
 
             if (existing != null)
             {
-                _log.warn(ServicesMessages.duplicateContribution(ic.getObject(), name, existing));
+                _log.error(ServicesMessages.duplicateContribution(
+                        ic.getObject(),
+                        contributionType,
+                        existing));
                 continue;
             }
 
-            result.put(name, ic.getObject());
+            result.put(contributionType, ic.getObject());
         }
 
         return result;

Added: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/AssetInjectionProvider.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/AssetInjectionProvider.java?view=auto&rev=523862
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/AssetInjectionProvider.java (added)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/AssetInjectionProvider.java Thu Mar 29 15:45:36 2007
@@ -0,0 +1,75 @@
+// 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.internal.services;
+
+import static java.lang.String.format;
+
+import org.apache.tapestry.annotations.Path;
+import org.apache.tapestry.ioc.ServiceLocator;
+import org.apache.tapestry.ioc.services.SymbolSource;
+import org.apache.tapestry.model.MutableComponentModel;
+import org.apache.tapestry.services.AssetSource;
+import org.apache.tapestry.services.ClassTransformation;
+import org.apache.tapestry.services.InjectionProvider;
+
+/**
+ * Performs injection of assets, based on the presence of the {@link Path} annotation. This is more
+ * useful than the general {@link AssetObjectProvider}, becase relative assets are supported.
+ */
+public class AssetInjectionProvider implements InjectionProvider
+{
+    private final SymbolSource _symbolSource;
+
+    private final AssetSource _assetSource;
+
+    public AssetInjectionProvider(SymbolSource symbolSource, AssetSource assetSource)
+    {
+        _symbolSource = symbolSource;
+        _assetSource = assetSource;
+    }
+
+    public boolean provideInjection(String fieldName, String fieldType, ServiceLocator locator,
+            ClassTransformation transformation, MutableComponentModel componentModel)
+    {
+        Path path = transformation.getFieldAnnotation(fieldName, Path.class);
+
+        if (path == null) return false;
+
+        String expanded = _symbolSource.expandSymbols(path.value());
+
+        String sourceFieldName = transformation.addInjectedField(
+                AssetSource.class,
+                "assetSource",
+                _assetSource);
+        String resourcesFieldName = transformation.getResourcesFieldName();
+
+        String statement = format(
+                "%s = (%s) %s.findAsset(%s.getBaseResource(), \"%s\", %s.getLocale());",
+                fieldName,
+                fieldType,
+                sourceFieldName,
+                resourcesFieldName,
+                expanded,
+                resourcesFieldName);
+
+        transformation.extendConstructor(statement);
+
+        transformation.makeReadOnly(fieldName);
+
+        return true;
+
+    }
+
+}

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/AssetObjectProvider.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/AssetObjectProvider.java?view=diff&rev=523862&r1=523861&r2=523862
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/AssetObjectProvider.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/AssetObjectProvider.java Thu Mar 29 15:45:36 2007
@@ -15,29 +15,33 @@
 package org.apache.tapestry.internal.services;
 
 import org.apache.tapestry.Asset;
+import org.apache.tapestry.annotations.Path;
+import org.apache.tapestry.ioc.AnnotationProvider;
 import org.apache.tapestry.ioc.ObjectProvider;
 import org.apache.tapestry.ioc.Resource;
 import org.apache.tapestry.ioc.ServiceLocator;
-import org.apache.tapestry.ioc.services.ThreadLocale;
+import org.apache.tapestry.ioc.services.SymbolSource;
+import org.apache.tapestry.ioc.services.TypeCoercer;
 import org.apache.tapestry.services.AssetSource;
 
 /**
- * Exposes assets (in the current locale).
+ * Exposes assets (in the current locale). The Inject annotation must be supplemented by a
+ * {@link Path} annotation, to identify what asset to be injected.
  */
 public class AssetObjectProvider implements ObjectProvider
 {
     private final AssetSource _source;
 
-    private final ThreadLocale _threadLocale;
+    private final TypeCoercer _typeCoercer;
 
-    private final Resource _classpathRootResource;
+    private final SymbolSource _symbolSource;
 
-    public AssetObjectProvider(AssetSource source, ThreadLocale threadLocale,
-            Resource classpathRootResource)
+    public AssetObjectProvider(AssetSource source, TypeCoercer typeCoercer,
+            SymbolSource symbolSource)
     {
         _source = source;
-        _threadLocale = threadLocale;
-        _classpathRootResource = classpathRootResource;
+        _typeCoercer = typeCoercer;
+        _symbolSource = symbolSource;
     }
 
     /**
@@ -52,14 +56,17 @@
      * @param locator
      *            not used
      */
-    public <T> T provide(String expression, Class<T> objectType, ServiceLocator locator)
+    public <T> T provide(Class<T> objectType, AnnotationProvider annotationProvider,
+            ServiceLocator locator)
     {
-        if (!objectType.isAssignableFrom(Asset.class))
-            throw new RuntimeException(ServicesMessages.assetNotCompatible(expression, objectType));
+        Path path = annotationProvider.getAnnotation(Path.class);
 
-        Asset asset = _source.findAsset(_classpathRootResource, expression, _threadLocale
-                .getLocale());
+        if (path == null) return null;
 
-        return objectType.cast(asset);
+        String expanded = _symbolSource.expandSymbols(path.value());
+
+        Asset asset = _source.findAsset(null, expanded, null);
+
+        return _typeCoercer.coerce(asset, objectType);
     }
 }

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/AssetSourceImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/AssetSourceImpl.java?view=diff&rev=523862&r1=523861&r2=523862
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/AssetSourceImpl.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/AssetSourceImpl.java Thu Mar 29 15:45:36 2007
@@ -14,10 +14,9 @@
 
 package org.apache.tapestry.internal.services;
 
-import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newMap;
 import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newConcurrentMap;
+import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newMap;
 import static org.apache.tapestry.ioc.internal.util.Defense.notBlank;
-import static org.apache.tapestry.ioc.internal.util.Defense.notNull;
 
 import java.util.Locale;
 import java.util.Map;
@@ -31,6 +30,8 @@
 
 public class AssetSourceImpl implements AssetSource
 {
+    private static final String CLASSPATH = "classpath";
+
     private final StrategyRegistry<AssetFactory> _registry;
 
     private final ThreadLocale _threadLocale;
@@ -62,21 +63,21 @@
 
     public Asset getClasspathAsset(String path)
     {
-        return getClasspathAsset(path, _threadLocale.getLocale());
+        return getClasspathAsset(path, null);
     }
 
     public Asset getClasspathAsset(String path, Locale locale)
     {
-        Resource baseResource = _prefixToRootResource.get("classpath");
-
-        return findAsset(baseResource, path, locale);
+        return findAsset(null, path, locale);
     }
 
     public Asset findAsset(Resource baseResource, String path, Locale locale)
     {
-        notNull(baseResource, "baseResource");
         notBlank(path, "path");
-        notNull(locale, "locale");
+
+        if (baseResource == null) baseResource = _prefixToRootResource.get(CLASSPATH);
+
+        if (locale == null) locale = _threadLocale.getLocale();
 
         int colonx = path.indexOf(':');
 

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/BasePropertyConduit.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/BasePropertyConduit.java?view=diff&rev=523862&r1=523861&r2=523862
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/BasePropertyConduit.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/BasePropertyConduit.java Thu Mar 29 15:45:36 2007
@@ -16,8 +16,8 @@
 
 import java.lang.annotation.Annotation;
 
-import org.apache.tapestry.AnnotationProvider;
 import org.apache.tapestry.PropertyConduit;
+import org.apache.tapestry.ioc.AnnotationProvider;
 import org.apache.tapestry.services.PropertyConduitSource;
 
 /**

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/FieldValidatorDefaultSourceImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/FieldValidatorDefaultSourceImpl.java?view=diff&rev=523862&r1=523861&r2=523862
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/FieldValidatorDefaultSourceImpl.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/FieldValidatorDefaultSourceImpl.java Thu Mar 29 15:45:36 2007
@@ -19,9 +19,9 @@
 import java.util.List;
 import java.util.Locale;
 
-import org.apache.tapestry.AnnotationProvider;
 import org.apache.tapestry.Field;
 import org.apache.tapestry.FieldValidator;
+import org.apache.tapestry.ioc.AnnotationProvider;
 import org.apache.tapestry.ioc.Messages;
 import org.apache.tapestry.services.FieldValidatorDefaultSource;
 import org.apache.tapestry.services.FieldValidatorSource;

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InjectBlockWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InjectBlockWorker.java?view=diff&rev=523862&r1=523861&r2=523862
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InjectBlockWorker.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InjectBlockWorker.java Thu Mar 29 15:45:36 2007
@@ -17,6 +17,7 @@
 import java.util.List;
 
 import org.apache.tapestry.Block;
+import org.apache.tapestry.annotations.Id;
 import org.apache.tapestry.annotations.Inject;
 import org.apache.tapestry.ioc.internal.util.InternalUtils;
 import org.apache.tapestry.ioc.util.BodyBuilder;
@@ -30,8 +31,8 @@
  * into read-only fields containing the injected Block from the template. The annotation's value is
  * the id of the block to inject; if ommitted, the block id is deduced from the field id.
  * <p>
- * Must be scheduled before {@link InjectNamedWorker} because it uses the same annotation, Inject,
- * with a different interpretation.
+ * Must be scheduled before {@link InjectWorker} because it uses the same annotation, Inject, with a
+ * different interpretation.
  */
 public class InjectBlockWorker implements ComponentClassTransformWorker
 {
@@ -41,8 +42,7 @@
     {
         List<String> fieldNames = transformation.findFieldsOfType(BLOCK_TYPE_NAME);
 
-        if (fieldNames.isEmpty())
-            return;
+        if (fieldNames.isEmpty()) return;
 
         BodyBuilder builder = new BodyBuilder();
         builder.begin();
@@ -53,25 +53,26 @@
 
         for (String fieldName : fieldNames)
         {
-            Inject annotation = transformation.getFieldAnnotation(fieldName, Inject.class);
+            Inject injectAnnotation = transformation.getFieldAnnotation(fieldName, Inject.class);
 
-            if (annotation == null)
-                continue;
+            if (injectAnnotation == null) continue;
+
+            Id annotation = transformation.getFieldAnnotation(fieldName, Id.class);
 
             String blockId = getBlockId(fieldName, annotation);
 
             builder.addln("%s = %s.getBlock(\"%s\");", fieldName, resourcesFieldName, blockId);
 
             transformation.makeReadOnly(fieldName);
-            transformation.claimField(fieldName, annotation);
+
+            transformation.claimField(fieldName, injectAnnotation);
 
             count++;
         }
 
         // Fields yes, but no annotations, so nothing to really do.
 
-        if (count == 0)
-            return;
+        if (count == 0) return;
 
         builder.end();
 
@@ -79,12 +80,9 @@
                 .toString());
     }
 
-    private String getBlockId(String fieldName, Inject annotation)
+    private String getBlockId(String fieldName, Id annotation)
     {
-        String annotationId = annotation.value();
-
-        if (InternalUtils.isNonBlank(annotationId))
-            return annotationId;
+        if (annotation != null) return annotation.value();
 
         return InternalUtils.stripMemberPrefix(fieldName);
     }

Copied: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InjectResourcesWorker.java (from r519727, tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InjectAnonymousWorker.java)
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InjectResourcesWorker.java?view=diff&rev=523862&p1=tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InjectAnonymousWorker.java&r1=519727&p2=tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InjectResourcesWorker.java&r2=523862
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InjectAnonymousWorker.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InjectResourcesWorker.java Thu Mar 29 15:45:36 2007
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 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.
@@ -22,23 +22,22 @@
 import org.apache.tapestry.services.InjectionProvider;
 
 /**
- * Performs anonymous injection, for the cases where a field is labled with the {@link Inject}
- * annotation, but no specific value was provided. This worker must be scheduled <em>after</em>
- * {@link InjectNamedWorker}.
+ * Performs injection of resources, for the cases where a field is labled with the {@link Inject}
+ * annotation, but no specific value was provided. This worker must be scheduled <em>before</em>
+ * {@link InjectWorker}.
  * <p>
  * The implementation of this worker mostly delegates to a chain of command of
  * {@link InjectionProvider}s.
  */
-public class InjectAnonymousWorker implements ComponentClassTransformWorker
+public class InjectResourcesWorker implements ComponentClassTransformWorker
 {
-
     private final ServiceLocator _locator;
 
     // Really, a chain of command
 
     private final InjectionProvider _injectionProvider;
 
-    public InjectAnonymousWorker(final ServiceLocator locator,
+    public InjectResourcesWorker(final ServiceLocator locator,
             final InjectionProvider injectionProvider)
     {
         _locator = locator;
@@ -60,11 +59,10 @@
                     transformation,
                     model);
 
-            if (!result)
-                throw new RuntimeException(ServicesMessages.noInjectionFound(transformation
-                        .getClassName(), fieldName, fieldType));
+            // If true, claim the field; otherwise ignore it (it will be handled by a later
+            // worker and an exception will be thrown if it ultimately can't be satisfied.
 
-            transformation.claimField(fieldName, annotation);
+            if (result) transformation.claimField(fieldName, annotation);
         }
     }
 

Copied: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InjectWorker.java (from r519727, tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InjectNamedWorker.java)
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InjectWorker.java?view=diff&rev=523862&p1=tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InjectNamedWorker.java&r1=519727&p2=tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InjectWorker.java&r2=523862
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InjectNamedWorker.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InjectWorker.java Thu Mar 29 15:45:36 2007
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 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.
@@ -14,30 +14,31 @@
 
 package org.apache.tapestry.internal.services;
 
+import java.lang.annotation.Annotation;
+
 import org.apache.tapestry.annotations.Inject;
+import org.apache.tapestry.ioc.AnnotationProvider;
 import org.apache.tapestry.ioc.ObjectProvider;
 import org.apache.tapestry.ioc.ServiceLocator;
-import org.apache.tapestry.ioc.internal.util.InternalUtils;
 import org.apache.tapestry.model.MutableComponentModel;
 import org.apache.tapestry.services.ClassTransformation;
 import org.apache.tapestry.services.ComponentClassTransformWorker;
 
 /**
- * Worker for the {@link org.apache.tapestry.annotations.Inject} annotation, but only works with
- * annotations where the annotation has a value (a name). In some cases, there are specific types
- * where the meaning of the value for the Inject annoation is different, works for those cases must
- * be scheduled <em>before</em> this worker, and must be sure to
- * {@link ClassTransformation#claimField(String, Object) claim the field}.
+ * Worker for the {@link org.apache.tapestry.annotations.Inject} annotation that delegates out to
+ * the master {@link ObjectProvider} to access the value. This worker must be scheduled after
+ * certain other workers, such as {@link InjectBlockWorker} (which is keyed off a combination of
+ * type and the Inject annotation).
  * 
  * @see ObjectProvider
  */
-public class InjectNamedWorker implements ComponentClassTransformWorker
+public class InjectWorker implements ComponentClassTransformWorker
 {
     private final ObjectProvider _objectProvider;
 
     private final ServiceLocator _locator;
 
-    public InjectNamedWorker(ObjectProvider objectProvider, ServiceLocator locator)
+    public InjectWorker(ObjectProvider objectProvider, ServiceLocator locator)
     {
         _objectProvider = objectProvider;
         _locator = locator;
@@ -49,14 +50,7 @@
         {
             Inject annotation = transformation.getFieldAnnotation(fieldName, Inject.class);
 
-            String value = annotation.value();
-
-            // A later worker will tackle this.
-
-            if (InternalUtils.isBlank(value))
-                continue;
-
-            injectNamed(fieldName, value, transformation, model);
+            inject(fieldName, transformation, model);
 
             transformation.claimField(fieldName, annotation);
         }
@@ -64,14 +58,32 @@
     }
 
     @SuppressWarnings("unchecked")
-    private void injectNamed(String fieldName, String value, ClassTransformation transformation,
+    private void inject(final String fieldName, final ClassTransformation transformation,
             MutableComponentModel model)
     {
         String fieldType = transformation.getFieldType(fieldName);
 
         Class type = transformation.toClass(fieldType);
 
-        Object inject = _objectProvider.provide(value, type, _locator);
+        AnnotationProvider annotationProvider = new AnnotationProvider()
+        {
+            public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
+            {
+                return transformation.getFieldAnnotation(fieldName, annotationClass);
+            }
+        };
+
+        Object inject = null;
+
+        try
+        {
+            inject = _objectProvider.provide(type, annotationProvider, _locator);
+        }
+        catch (Exception ex)
+        {
+            throw new RuntimeException(ServicesMessages.fieldInjectionError(transformation
+                    .getClassName(), fieldName, ex), ex);
+        }
 
         transformation.injectField(fieldName, inject);
     }

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=523862&r1=523861&r2=523862
==============================================================================
--- 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 Mar 29 15:45:36 2007
@@ -32,7 +32,6 @@
 import org.apache.tapestry.internal.bindings.LiteralBinding;
 import org.apache.tapestry.internal.bindings.PropBindingFactory;
 import org.apache.tapestry.internal.util.IntegerRange;
-import org.apache.tapestry.ioc.Configuration;
 import org.apache.tapestry.ioc.Location;
 import org.apache.tapestry.ioc.LogSource;
 import org.apache.tapestry.ioc.MappedConfiguration;
@@ -41,13 +40,14 @@
 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.Value;
 import org.apache.tapestry.ioc.services.ChainBuilder;
 import org.apache.tapestry.ioc.services.ClassFactory;
 import org.apache.tapestry.ioc.services.PropertyAccess;
+import org.apache.tapestry.ioc.services.SymbolSource;
 import org.apache.tapestry.ioc.services.ThreadCleanupHub;
 import org.apache.tapestry.ioc.services.ThreadLocale;
 import org.apache.tapestry.ioc.services.TypeCoercer;
-import org.apache.tapestry.services.AliasContribution;
 import org.apache.tapestry.services.ApplicationGlobals;
 import org.apache.tapestry.services.ApplicationInitializer;
 import org.apache.tapestry.services.ApplicationInitializerFilter;
@@ -82,15 +82,20 @@
         return new TemplateParserImpl(log, configuration);
     }
 
-    public static void contributeTemplateParser(MappedConfiguration<String, URL> map)
+    public static void contributeTemplateParser(MappedConfiguration<String, URL> configuration)
     {
         Class c = InternalModule.class;
-        map.add("-//W3C//DTD XHTML 1.0 Strict//EN", c.getResource("xhtml1-strict.dtd"));
-        map.add("-//W3C//DTD XHTML 1.0 Transitional//EN", c.getResource("xhtml1-transitional.dtd"));
-        map.add("-//W3C//DTD XHTML 1.0 Frameset//EN", c.getResource("xhtml1-frameset.dtd"));
-        map.add("-//W3C//ENTITIES Latin 1 for XHTML//EN", c.getResource("xhtml-lat1.ent"));
-        map.add("-//W3C//ENTITIES Symbols for XHTML//EN", c.getResource("xhtml-symbol.ent"));
-        map.add("-//W3C//ENTITIES Special for XHTML//EN", c.getResource("xhtml-special.ent"));
+        configuration.add("-//W3C//DTD XHTML 1.0 Strict//EN", c.getResource("xhtml1-strict.dtd"));
+        configuration.add("-//W3C//DTD XHTML 1.0 Transitional//EN", c
+                .getResource("xhtml1-transitional.dtd"));
+        configuration.add("-//W3C//DTD XHTML 1.0 Frameset//EN", c
+                .getResource("xhtml1-frameset.dtd"));
+        configuration
+                .add("-//W3C//ENTITIES Latin 1 for XHTML//EN", c.getResource("xhtml-lat1.ent"));
+        configuration.add("-//W3C//ENTITIES Symbols for XHTML//EN", c
+                .getResource("xhtml-symbol.ent"));
+        configuration.add("-//W3C//ENTITIES Special for XHTML//EN", c
+                .getResource("xhtml-special.ent"));
     }
 
     public static PageResponseRenderer build(@InjectService("PageMarkupRenderer")
@@ -159,15 +164,6 @@
         configuration.add("tapestry.scriptaculous.path", "org/apache/tapestry/scriptaculous_1_7_0");
     }
 
-    public static void contributeAlias(Configuration<AliasContribution> configuration,
-
-    @InjectService("DefaultRequestExceptionHandler")
-    RequestExceptionHandler defaultRequestExceptionHandler)
-    {
-        configuration.add(new AliasContribution("RequestExceptionHandler",
-                defaultRequestExceptionHandler));
-    }
-
     private final ComponentInstantiatorSource _componentInstantiatorSource;
 
     private final ComponentTemplateSource _componentTemplateSource;
@@ -212,10 +208,10 @@
     @InjectService("ChainBuilder")
     ChainBuilder chainBuilder,
 
-    @Inject("alias:Request")
+    @Inject
     Request request,
 
-    @Inject("alias:Response")
+    @Inject
     Response response,
 
     @InjectService("ContextPathSource")
@@ -227,7 +223,7 @@
     @InjectService("ThreadLocale")
     ThreadLocale threadLocale,
 
-    @Inject("alias:RequestGlobals")
+    @Inject
     RequestGlobals requestGlobals,
 
     @InjectService("RequestPageCache")
@@ -249,7 +245,9 @@
     }
 
     public PageTemplateLocator build(@InjectService("ContextAssetFactory")
-    AssetFactory contextAssetFactory, @Inject("alias:ComponentClassResolver")
+    AssetFactory contextAssetFactory,
+
+    @Inject
     ComponentClassResolver componentClassResolver)
     {
         return new PageTemplateLocatorImpl(contextAssetFactory.getRootResource(),
@@ -287,15 +285,19 @@
     @InjectService("ComponentInvocationMap")
     ComponentInvocationMap componentInvocationMap,
 
-    @Inject("alias:TypeCoercer")
+    @Inject
     TypeCoercer typeCoercer)
     {
         return new LinkFactoryImpl(_contextPathSource, encoder, _componentClassResolver,
                 componentInvocationMap, _pageCache, typeCoercer);
     }
 
-    public PagePool build(Log log, @InjectService("PageLoader")
-    PageLoader pageLoader, @Inject("alias:ComponentMessagesSource")
+    public PagePool build(Log log,
+
+    @InjectService("PageLoader")
+    PageLoader pageLoader,
+
+    @Inject
     ComponentMessagesSource componentMessagesSource)
     {
         PagePoolImpl service = new PagePoolImpl(log, pageLoader, _threadLocale);
@@ -321,7 +323,7 @@
     @InjectService("BindingSource")
     BindingSource bindingSource,
 
-    @Inject("alias:PersistentFieldManager")
+    @Inject
     PersistentFieldManager persistentFieldManager)
     {
         PageLoaderImpl service = new PageLoaderImpl(_componentTemplateSource, pageElementFactory,
@@ -350,13 +352,14 @@
     public LocalizationSetter build(@InjectService("PersistentLocale")
     PersistentLocale persistentLocale,
 
-    @Inject("${tapestry.supported-locales}")
+    @Inject
+    @Value("${tapestry.supported-locales}")
     String localeNames)
     {
         return new LocalizationSetterImpl(persistentLocale, _threadLocale, localeNames);
     }
 
-    public ResourceCache build(@Inject("alias:ResourceDigestGenerator")
+    public ResourceCache build(@Inject
     ResourceDigestGenerator digestGenerator)
     {
         ResourceCacheImpl service = new ResourceCacheImpl(digestGenerator);
@@ -377,22 +380,21 @@
         return service;
     }
 
-    public PageElementFactory build(@Inject("alias:TypeCoercer")
+    public PageElementFactory build(@Inject
     TypeCoercer typeCoercer,
 
-    @Inject("alias:BindingSource")
+    @Inject
     BindingSource bindingSource,
 
-    @Inject("alias:ComponentMessagesSource")
+    @Inject
     ComponentMessagesSource componentMessagesSource)
     {
         return new PageElementFactoryImpl(_componentInstantiatorSource, _componentClassResolver,
                 typeCoercer, bindingSource, componentMessagesSource);
     }
 
-    public ActionLinkHandler buildActionLinkHandler(
-            @Inject("alias:ComponentEventResultProcessor")
-            ComponentEventResultProcessor resultProcessor)
+    public ActionLinkHandler buildActionLinkHandler(@Inject
+    ComponentEventResultProcessor resultProcessor)
     {
         return new ActionLinkHandlerImpl(resultProcessor, _pageCache, _linkFactory);
     }
@@ -403,7 +405,9 @@
     }
 
     public AssetFactory buildClasspathAssetFactory(@InjectService("ResourceCache")
-    ResourceCache resourceCache, @Inject("alias:ClasspathAssetAliasManager")
+    ResourceCache resourceCache,
+
+    @Inject
     ClasspathAssetAliasManager aliasManager)
     {
         ClasspathAssetFactory factory = new ClasspathAssetFactory(resourceCache, aliasManager);
@@ -413,7 +417,7 @@
         return factory;
     }
 
-    public AssetFactory buildContextAssetFactory(@Inject("alias:ApplicationGlobals")
+    public AssetFactory buildContextAssetFactory(@Inject
     ApplicationGlobals globals)
     {
         return new ContextAssetFactory(_contextPathSource, globals.getContext());
@@ -463,9 +467,8 @@
         return _request;
     }
 
-    public PageLinkHandler buildPageLinkHandler(
-            @Inject("alias:ComponentEventResultProcessor")
-            ComponentEventResultProcessor resultProcessor)
+    public PageLinkHandler buildPageLinkHandler(@Inject
+    ComponentEventResultProcessor resultProcessor)
     {
         return new PageLinkHandlerImpl(_pageCache, resultProcessor);
     }
@@ -480,8 +483,9 @@
      *            may return a binding if applicable, or null otherwise
      */
     public BindingFactory buildPropBindingFactory(List<BindingFactory> configuration,
-            @Inject("alias:PropertyConduitSource")
-            PropertyConduitSource propertyConduitSource)
+
+    @Inject
+    PropertyConduitSource propertyConduitSource)
     {
         PropBindingFactory service = new PropBindingFactory(propertyConduitSource);
 
@@ -526,13 +530,13 @@
     public void contributeApplicationInitializer(
             OrderedConfiguration<ApplicationInitializerFilter> configuration,
 
-            @Inject("alias:ApplicationGlobals")
+            @Inject
             final ApplicationGlobals applicationGlobals,
 
-            @Inject("alias:PropertyAccess")
+            @Inject
             final PropertyAccess propertyAccess,
 
-            @Inject("alias:TypeCoercer")
+            @Inject
             final TypeCoercer typeCoercer)
     {
         ApplicationInitializerFilter setApplicationPackage = new ApplicationInitializerFilter()
@@ -718,7 +722,8 @@
             @InjectService("RequestGlobals")
             final RequestGlobals requestGlobals,
 
-            @Inject("${tapestry.file-check-interval}")
+            @Inject
+            @Value("${tapestry.file-check-interval}")
             long checkInterval,
 
             @InjectService("LocalizationSetter")
@@ -730,13 +735,15 @@
         configuration.add("Localization", new LocalizationFilter(localizationSetter));
     }
 
-    public ObjectProvider buildAssetObjectProvider(@Inject("alias:AssetSource")
+    public static ObjectProvider buildAssetObjectProvider(@InjectService("AssetSource")
     AssetSource assetSource,
 
-    @InjectService("ClasspathAssetFactory")
-    AssetFactory classpathAssetFactory)
+    @InjectService("SymbolSource")
+    SymbolSource symbolSource,
+
+    @InjectService("TypeCoercer")
+    TypeCoercer typeCoercer)
     {
-        return new AssetObjectProvider(assetSource, _threadLocale, classpathAssetFactory
-                .getRootResource());
+        return new AssetObjectProvider(assetSource, typeCoercer, symbolSource);
     }
 }

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/PageRenderSupportImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/PageRenderSupportImpl.java?view=diff&rev=523862&r1=523861&r2=523862
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/PageRenderSupportImpl.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/PageRenderSupportImpl.java Thu Mar 29 15:45:36 2007
@@ -19,10 +19,9 @@
 
 import org.apache.tapestry.Asset;
 import org.apache.tapestry.PageRenderSupport;
-import org.apache.tapestry.ioc.Resource;
 import org.apache.tapestry.ioc.internal.util.IdAllocator;
 import org.apache.tapestry.ioc.services.SymbolSource;
-import org.apache.tapestry.services.AssetFactory;
+import org.apache.tapestry.services.AssetSource;
 
 public class PageRenderSupportImpl implements PageRenderSupport
 {
@@ -32,14 +31,14 @@
 
     private final SymbolSource _symbolSource;
 
-    private final AssetFactory _assetFactory;
+    private final AssetSource _assetSource;
 
     public PageRenderSupportImpl(DocumentScriptBuilder builder, SymbolSource symbolSource,
-            AssetFactory classpathAssetFactory)
+            AssetSource assetSource)
     {
         _builder = builder;
         _symbolSource = symbolSource;
-        _assetFactory = classpathAssetFactory;
+        _assetSource = assetSource;
     }
 
     public String allocateClientId(String id)
@@ -63,9 +62,7 @@
         {
             String expanded = _symbolSource.expandSymbols(path);
 
-            Resource resource = _assetFactory.getRootResource().forFile(expanded);
-
-            Asset asset = _assetFactory.createAsset(resource);
+            Asset asset = _assetSource.findAsset(null, expanded, null);
 
             _builder.addScriptLink(asset.toClientURL());
         }