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/14 18:47:17 UTC
svn commit: r518235 [1/2] - in /tapestry/tapestry5:
tapestry-core/trunk/src/main/java/org/apache/tapestry/annotations/
tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/base/
tapestry-core/trunk/src/main/java/org/apache/tapestry/corelib/com...
Author: hlship
Date: Wed Mar 14 10:47:14 2007
New Revision: 518235
URL: http://svn.apache.org/viewvc?view=rev&rev=518235
Log:
TAPESTRY-1335: The "infrastructure:" object provider prefix is too long and the name is confusing, rename to "alias:"
Added:
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/AliasImpl.java
- copied, changed from r517898, tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InfrastructureImpl.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/AliasManagerImpl.java
- copied, changed from r517898, tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InfrastructureManagerImpl.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/Alias.java
- copied, changed from r517898, tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/Infrastructure.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/AliasContribution.java
- copied, changed from r517898, tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/InfrastructureContribution.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/AliasManager.java
- copied, changed from r517898, tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/InfrastructureManager.java
tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/alias.apt
- copied, changed from r517898, tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/infrastructure.apt
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/AliasImplTest.java
- copied, changed from r517898, tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/InfrastructureImplTest.java
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/AliasManagerImplTest.java
- copied, changed from r517898, tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/InfrastructureManagerImplTest.java
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/services/AliasContributionTest.java
- copied, changed from r517898, tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/services/InfrastructureContributionTest.java
Removed:
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InfrastructureImpl.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InfrastructureManagerImpl.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/Infrastructure.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/InfrastructureContribution.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/InfrastructureManager.java
tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/infrastructure.apt
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/InfrastructureImplTest.java
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/InfrastructureManagerImplTest.java
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/services/InfrastructureContributionTest.java
Modified:
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/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/TapestryAppInitializer.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/ComponentMessagesSourceImpl.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/ResourceDigestGeneratorImpl.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/test/InternalBaseTestCase.java
tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/RequestGlobals.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/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/inject.apt
tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/parameters.apt
tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/request.apt
tapestry/tapestry5/tapestry-core/trunk/src/site/site.xml
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/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/ComponentInstantiatorSourceImplTest.java
tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/services/PropertyConduitSourceImplTest.java
tapestry/tapestry5/tapestry-hibernate/trunk/src/main/java/org/apache/tapestry/hibernate/HibernateModule.java
tapestry/tapestry5/tapestry-ioc/trunk/src/site/apt/index.apt
tapestry/tapestry5/tapestry-ioc/trunk/src/site/apt/module.apt
tapestry/tapestry5/tapestry-ioc/trunk/src/site/apt/provider.apt
tapestry/tapestry5/tapestry-spring/trunk/src/main/java/org/apache/tapestry/spring/SpringModule.java
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=518235&r1=518234&r2=518235
==============================================================================
--- 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 Wed Mar 14 10:47:14 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.
@@ -35,7 +35,7 @@
* In most other cases, the value is an object reference. A common example:
*
* <pre>
- * @Inject("infrastructure:Request")
+ * @Inject("alias:Request")
* private Request _request;
* </pre>
*
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=518235&r1=518234&r2=518235
==============================================================================
--- 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 Wed Mar 14 10:47:14 2007
@@ -142,7 +142,7 @@
@Inject
private ComponentResources _resources;
- @Inject("infrastructure:DefaultComponentParameterBindingSource")
+ @Inject("alias:DefaultComponentParameterBindingSource")
private DefaultComponentParameterBindingSource _defaultBindingSource;
final String defaultLabel()
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=518235&r1=518234&r2=518235
==============================================================================
--- 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 Wed Mar 14 10:47:14 2007
@@ -69,13 +69,13 @@
@Environmental
private ValidationTracker _tracker;
- @Inject("infrastructure:ValidationMessagesSource")
+ @Inject("alias:ValidationMessagesSource")
private ValidationMessagesSource _messagesSource;
- @Inject("infrastructure:TranslatorDefaultSource")
+ @Inject("alias:TranslatorDefaultSource")
private TranslatorDefaultSource _translatorDefaultSource;
- @Inject("infrastructure:FieldValidatorDefaultSource")
+ @Inject("alias:FieldValidatorDefaultSource")
private FieldValidatorDefaultSource _fieldValidatorDefaultSource;
@Inject
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=518235&r1=518234&r2=518235
==============================================================================
--- 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 Wed Mar 14 10:47:14 2007
@@ -79,13 +79,13 @@
@Inject
private ComponentResources _resources;
- @Inject("infrastructure:BeanModelSource")
+ @Inject("alias:BeanModelSource")
private BeanModelSource _modelSource;
- @Inject("infrastructure:TranslatorDefaultSource")
+ @Inject("alias:TranslatorDefaultSource")
private TranslatorDefaultSource _translatorDefaultSource;
- @Inject("infrastructure:FieldValidatorDefaultSource")
+ @Inject("alias:FieldValidatorDefaultSource")
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=518235&r1=518234&r2=518235
==============================================================================
--- 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 Wed Mar 14 10:47:14 2007
@@ -138,7 +138,7 @@
@Parameter("true")
private boolean _clientValidation;
- @Inject("infrastructure:Environment")
+ @Inject("alias:Environment")
private Environment _environment;
@Inject
@@ -150,7 +150,7 @@
@Inject("service:FormParameterLookup")
private FormParameterLookup _paramLookup;
- @Inject("infrastructure:ComponentSource")
+ @Inject("alias:ComponentSource")
private ComponentSource _source;
@Persist
@@ -279,7 +279,7 @@
_tracker = _environment.pop(ValidationTracker.class);
}
- @Inject("infrastructure:ComponentEventResultProcessor")
+ @Inject("alias:ComponentEventResultProcessor")
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=518235&r1=518234&r2=518235
==============================================================================
--- 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 Wed Mar 14 10:47:14 2007
@@ -104,10 +104,10 @@
@Inject
private ComponentResources _resources;
- @Inject("infrastructure:BeanModelSource")
+ @Inject("alias:BeanModelSource")
private BeanModelSource _modelSource;
- @Inject("infrastructure:TypeCoercer")
+ @Inject("alias:TypeCoercer")
private TypeCoercer _typeCoercer;
// Transformed version of the source parameter.
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=518235&r1=518234&r2=518235
==============================================================================
--- 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 Wed Mar 14 10:47:14 2007
@@ -51,7 +51,7 @@
@Parameter("componentResources.elementName")
private String _elementName;
- @Inject("infrastructure:DefaultComponentParameterBindingSource")
+ @Inject("alias:DefaultComponentParameterBindingSource")
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=518235&r1=518234&r2=518235
==============================================================================
--- 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 Wed Mar 14 10:47:14 2007
@@ -37,7 +37,7 @@
@Parameter(required = true)
private String _value;
- @Inject("infrastructure:DefaultComponentParameterBindingSource")
+ @Inject("alias:DefaultComponentParameterBindingSource")
private DefaultComponentParameterBindingSource _defaultBindingSource;
@Inject
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=518235&r1=518234&r2=518235
==============================================================================
--- 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 Wed Mar 14 10:47:14 2007
@@ -29,7 +29,7 @@
@Parameter(required = true)
private Object _object;
- @Inject("infrastructure:ObjectRenderer")
+ @Inject("alias:ObjectRenderer")
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=518235&r1=518234&r2=518235
==============================================================================
--- 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 Wed Mar 14 10:47:14 2007
@@ -83,7 +83,7 @@
@SuppressWarnings("unchecked")
private FieldValidator<Object> _validate = NOOP_VALIDATOR;
- @Inject("infrastructure:FieldValidatorDefaultSource")
+ @Inject("alias:FieldValidatorDefaultSource")
private FieldValidatorDefaultSource _fieldValidatorDefaultSource;
@Environmental
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=518235&r1=518234&r2=518235
==============================================================================
--- 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 Wed Mar 14 10:47:14 2007
@@ -43,7 +43,7 @@
@Inject("service:ExceptionAnalyzer")
private ExceptionAnalyzer _analyzer;
- @Inject("infrastructure:Request")
+ @Inject("alias:Request")
private Request _request;
public void reportException(Throwable exception)
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/TapestryAppInitializer.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/TapestryAppInitializer.java?view=diff&rev=518235&r1=518234&r2=518235
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/TapestryAppInitializer.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/TapestryAppInitializer.java Wed Mar 14 10:47:14 2007
@@ -21,7 +21,7 @@
import org.apache.tapestry.ioc.Registry;
import org.apache.tapestry.ioc.RegistryBuilder;
import org.apache.tapestry.ioc.internal.util.InternalUtils;
-import org.apache.tapestry.services.Infrastructure;
+import org.apache.tapestry.services.Alias;
import org.apache.tapestry.services.TapestryModule;
/**
@@ -40,7 +40,7 @@
private String _appName;
- private String _infrastructureMode;
+ private String _aliasMode;
private Registry _registry;
@@ -50,17 +50,17 @@
private final Map<String, Object> _serviceOverrides;
- public TapestryAppInitializer(String appPackage, String appName, String infrastructureMode)
+ public TapestryAppInitializer(String appPackage, String appName, String aliasMode)
{
- this(appPackage, appName, infrastructureMode, null);
+ this(appPackage, appName, aliasMode, null);
}
- public TapestryAppInitializer(String appPackage, String appName, String infrastructureMode,
+ public TapestryAppInitializer(String appPackage, String appName, String aliasMode,
Map<String, Object> serviceOverrides)
{
_appPackage = appPackage;
_appName = appName;
- _infrastructureMode = infrastructureMode;
+ _aliasMode = aliasMode;
_serviceOverrides = serviceOverrides;
_startTime = System.currentTimeMillis();
@@ -116,8 +116,9 @@
private void setupServices()
{
- Infrastructure infra = _registry.getService("Infrastructure", Infrastructure.class);
- infra.setMode(_infrastructureMode);
+ Alias alias = _registry.getService("Alias", Alias.class);
+
+ alias.setMode(_aliasMode);
}
/**
Copied: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/AliasImpl.java (from r517898, tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InfrastructureImpl.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=518235&p1=tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InfrastructureImpl.java&r1=517898&p2=tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/AliasImpl.java&r2=518235
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InfrastructureImpl.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/AliasImpl.java Wed Mar 14 10:47:14 2007
@@ -22,28 +22,24 @@
import org.apache.tapestry.ioc.ObjectProvider;
import org.apache.tapestry.ioc.ServiceLocator;
import org.apache.tapestry.ioc.internal.util.OneShotLock;
-import org.apache.tapestry.services.Infrastructure;
-import org.apache.tapestry.services.InfrastructureManager;
+import org.apache.tapestry.services.Alias;
+import org.apache.tapestry.services.AliasManager;
-/**
- * TODO: Extra configuration to support application overrides.
- */
-public class InfrastructureImpl implements Infrastructure, ObjectProvider
+public class AliasImpl implements Alias, ObjectProvider
{
// Derived from the managers when first needed
private final Map<String, Object> _properties = newCaseInsensitiveMap();
- private InfrastructureManager _masterManager;
+ private AliasManager _masterManager;
- private InfrastructureManager _overridesManager;
+ private AliasManager _overridesManager;
private String _mode;
private final OneShotLock _lock = new OneShotLock();
- public InfrastructureImpl(InfrastructureManager masterManager,
- InfrastructureManager overridesManager)
+ public AliasImpl(AliasManager masterManager, AliasManager overridesManager)
{
_masterManager = masterManager;
_overridesManager = overridesManager;
@@ -65,8 +61,8 @@
_lock.lock();
- _properties.putAll(_masterManager.getContributionsForMode(_mode));
- _properties.putAll(_overridesManager.getContributionsForMode(_mode));
+ _properties.putAll(_masterManager.getAliasesForMode(_mode));
+ _properties.putAll(_overridesManager.getAliasesForMode(_mode));
_masterManager = null;
_overridesManager = null;
@@ -75,12 +71,12 @@
public <T> T provide(String expression, Class<T> objectType, ServiceLocator locator)
{
if (_properties.isEmpty())
- throw new RuntimeException(ServicesMessages.infrastructureModeNotSet());
+ throw new RuntimeException(ServicesMessages.aliasModeNotSet());
Object object = _properties.get(expression);
if (object == null)
- throw new RuntimeException(ServicesMessages.infrastructurePropertyNotFound(
+ throw new RuntimeException(ServicesMessages.aliasPropertyNotFound(
expression,
_properties.keySet()));
@@ -90,7 +86,7 @@
}
catch (ClassCastException ex)
{
- throw new RuntimeException(ServicesMessages.infrastructurePropertyWrongType(
+ throw new RuntimeException(ServicesMessages.aliasPropertyWrongType(
expression,
object,
objectType), ex);
Copied: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/AliasManagerImpl.java (from r517898, tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InfrastructureManagerImpl.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=518235&p1=tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InfrastructureManagerImpl.java&r1=517898&p2=tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/AliasManagerImpl.java&r2=518235
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/InfrastructureManagerImpl.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/AliasManagerImpl.java Wed Mar 14 10:47:14 2007
@@ -20,22 +20,22 @@
import java.util.Map;
import org.apache.commons.logging.Log;
-import org.apache.tapestry.services.InfrastructureContribution;
-import org.apache.tapestry.services.InfrastructureManager;
+import org.apache.tapestry.services.AliasContribution;
+import org.apache.tapestry.services.AliasManager;
-public class InfrastructureManagerImpl implements InfrastructureManager
+public class AliasManagerImpl implements AliasManager
{
private final Log _log;
- private final Collection<InfrastructureContribution> _contributions;
+ private final Collection<AliasContribution> _contributions;
- public InfrastructureManagerImpl(Log log, Collection<InfrastructureContribution> contributions)
+ public AliasManagerImpl(Log log, Collection<AliasContribution> contributions)
{
_log = log;
_contributions = contributions;
}
- public Map<String, Object> getContributionsForMode(String mode)
+ public Map<String, Object> getAliasesForMode(String mode)
{
Map<String, Object> general = buildMapForMode("");
Map<String, Object> specific = buildMapForMode(mode);
@@ -51,7 +51,7 @@
{
Map<String, Object> result = newCaseInsensitiveMap();
- for (InfrastructureContribution ic : _contributions)
+ for (AliasContribution ic : _contributions)
{
if (!ic.getMode().equals(mode))
continue;
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/ComponentMessagesSourceImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/ComponentMessagesSourceImpl.java?view=diff&rev=518235&r1=518234&r2=518235
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/ComponentMessagesSourceImpl.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/ComponentMessagesSourceImpl.java Wed Mar 14 10:47:14 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.
@@ -24,10 +24,6 @@
import org.apache.tapestry.model.ComponentModel;
import org.apache.tapestry.services.ComponentMessagesSource;
-/**
- * Implementation of {@link ComponentMessagesSource} available as
- * service:tapestry.ComponentMessagesSource or infrastructure:ComponentMessagesSource.
- */
public class ComponentMessagesSourceImpl implements ComponentMessagesSource, UpdateListener
{
private final MessagesSource _messagesSource;
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=518235&r1=518234&r2=518235
==============================================================================
--- 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 Wed Mar 14 10:47:14 2007
@@ -59,7 +59,7 @@
import org.apache.tapestry.services.ComponentEventResultProcessor;
import org.apache.tapestry.services.ComponentMessagesSource;
import org.apache.tapestry.services.Context;
-import org.apache.tapestry.services.InfrastructureContribution;
+import org.apache.tapestry.services.AliasContribution;
import org.apache.tapestry.services.MarkupWriterFactory;
import org.apache.tapestry.services.ObjectRenderer;
import org.apache.tapestry.services.PageRenderInitializer;
@@ -147,13 +147,12 @@
configuration.add("tapestry.scriptaculous.path", "org/apache/tapestry/scriptaculous_1_7_0");
}
- public static void contributeInfrastructure(
- Configuration<InfrastructureContribution> configuration,
+ public static void contributeAlias(Configuration<AliasContribution> configuration,
- @InjectService("DefaultRequestExceptionHandler")
- RequestExceptionHandler defaultRequestExceptionHandler)
+ @InjectService("DefaultRequestExceptionHandler")
+ RequestExceptionHandler defaultRequestExceptionHandler)
{
- configuration.add(new InfrastructureContribution("RequestExceptionHandler",
+ configuration.add(new AliasContribution("RequestExceptionHandler",
defaultRequestExceptionHandler));
}
@@ -199,10 +198,10 @@
@InjectService("ChainBuilder")
ChainBuilder chainBuilder,
- @Inject("infrastructure:Request")
+ @Inject("alias:Request")
Request request,
- @Inject("infrastructure:Response")
+ @Inject("alias:Response")
Response response,
@InjectService("LinkFactory")
@@ -211,7 +210,7 @@
@InjectService("ThreadLocale")
ThreadLocale threadLocale,
- @Inject("infrastructure:RequestGlobals")
+ @Inject("alias:RequestGlobals")
RequestGlobals requestGlobals,
@InjectService("RequestPageCache")
@@ -232,7 +231,7 @@
}
public PageTemplateLocator build(@InjectService("ContextAssetFactory")
- AssetFactory contextAssetFactory, @Inject("infrastructure:ComponentClassResolver")
+ AssetFactory contextAssetFactory, @Inject("alias:ComponentClassResolver")
ComponentClassResolver componentClassResolver)
{
return new PageTemplateLocatorImpl(contextAssetFactory.getRootResource(),
@@ -273,7 +272,7 @@
@InjectService("ComponentInvocationMap")
ComponentInvocationMap componentInvocationMap,
- @Inject("infrastructure:TypeCoercer")
+ @Inject("alias:TypeCoercer")
TypeCoercer typeCoercer)
{
return new LinkFactoryImpl(contextPathSource, encoder, _componentClassResolver,
@@ -281,7 +280,7 @@
}
public PagePool build(Log log, @InjectService("PageLoader")
- PageLoader pageLoader, @Inject("infrastructure:ComponentMessagesSource")
+ PageLoader pageLoader, @Inject("alias:ComponentMessagesSource")
ComponentMessagesSource componentMessagesSource)
{
PagePoolImpl service = new PagePoolImpl(log, pageLoader, _threadLocale);
@@ -307,7 +306,7 @@
@InjectService("BindingSource")
BindingSource bindingSource,
- @Inject("infrastructure:PersistentFieldManager")
+ @Inject("alias:PersistentFieldManager")
PersistentFieldManager persistentFieldManager)
{
PageLoaderImpl service = new PageLoaderImpl(_componentTemplateSource, pageElementFactory,
@@ -342,7 +341,7 @@
return new LocalizationSetterImpl(persistentLocale, _threadLocale, localeNames);
}
- public ResourceCache build(@Inject("infrastructure:ResourceDigestGenerator")
+ public ResourceCache build(@Inject("alias:ResourceDigestGenerator")
ResourceDigestGenerator digestGenerator)
{
ResourceCacheImpl service = new ResourceCacheImpl(digestGenerator);
@@ -363,13 +362,13 @@
return service;
}
- public PageElementFactory build(@Inject("infrastructure:TypeCoercer")
+ public PageElementFactory build(@Inject("alias:TypeCoercer")
TypeCoercer typeCoercer,
- @Inject("infrastructure:BindingSource")
+ @Inject("alias:BindingSource")
BindingSource bindingSource,
- @Inject("infrastructure:ComponentMessagesSource")
+ @Inject("alias:ComponentMessagesSource")
ComponentMessagesSource componentMessagesSource)
{
return new PageElementFactoryImpl(_componentInstantiatorSource, _componentClassResolver,
@@ -377,7 +376,7 @@
}
public ActionLinkHandler buildActionLinkHandler(
- @Inject("infrastructure:ComponentEventResultProcessor")
+ @Inject("alias:ComponentEventResultProcessor")
ComponentEventResultProcessor resultProcessor)
{
return new ActionLinkHandlerImpl(resultProcessor, _pageCache, _linkFactory);
@@ -389,7 +388,7 @@
}
public AssetFactory buildClasspathAssetFactory(@InjectService("ResourceCache")
- ResourceCache resourceCache, @Inject("infrastructure:ClasspathAssetAliasManager")
+ ResourceCache resourceCache, @Inject("alias:ClasspathAssetAliasManager")
ClasspathAssetAliasManager aliasManager)
{
ClasspathAssetFactory factory = new ClasspathAssetFactory(resourceCache, aliasManager);
@@ -399,7 +398,7 @@
return factory;
}
- public AssetFactory buildContextAssetFactory(@Inject("infrastructure:ApplicationGlobals")
+ public AssetFactory buildContextAssetFactory(@Inject("alias:ApplicationGlobals")
ApplicationGlobals globals)
{
return new ContextAssetFactory(_request, globals.getContext());
@@ -450,7 +449,7 @@
}
public PageLinkHandler buildPageLinkHandler(
- @Inject("infrastructure:ComponentEventResultProcessor")
+ @Inject("alias:ComponentEventResultProcessor")
ComponentEventResultProcessor resultProcessor)
{
return new PageLinkHandlerImpl(_pageCache, resultProcessor);
@@ -466,7 +465,7 @@
* may return a binding if applicable, or null otherwise
*/
public BindingFactory buildPropBindingFactory(List<BindingFactory> configuration,
- @Inject("infrastructure:PropertyConduitSource")
+ @Inject("alias:PropertyConduitSource")
PropertyConduitSource propertyConduitSource)
{
PropBindingFactory service = new PropBindingFactory(propertyConduitSource);
@@ -512,13 +511,13 @@
public void contributeApplicationInitializer(
OrderedConfiguration<ApplicationInitializerFilter> configuration,
- @Inject("infrastructure:ApplicationGlobals")
+ @Inject("alias:ApplicationGlobals")
final ApplicationGlobals applicationGlobals,
- @Inject("infrastructure:PropertyAccess")
+ @Inject("alias:PropertyAccess")
final PropertyAccess propertyAccess,
- @Inject("infrastructure:TypeCoercer")
+ @Inject("alias:TypeCoercer")
final TypeCoercer typeCoercer)
{
ApplicationInitializerFilter setApplicationPackage = new ApplicationInitializerFilter()
@@ -716,7 +715,7 @@
configuration.add("Localization", new LocalizationFilter(localizationSetter));
}
- public ObjectProvider buildAssetObjectProvider(@Inject("infrastructure:AssetSource")
+ public ObjectProvider buildAssetObjectProvider(@Inject("alias:AssetSource")
AssetSource assetSource,
@InjectService("ClasspathAssetFactory")
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/ResourceDigestGeneratorImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/ResourceDigestGeneratorImpl.java?view=diff&rev=518235&r1=518234&r2=518235
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/ResourceDigestGeneratorImpl.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/ResourceDigestGeneratorImpl.java Wed Mar 14 10:47:14 2007
@@ -26,8 +26,6 @@
/**
* Implementation of {@link ResourceDigestGenerator} that generates MD5 digests.
- * Available as service:tapestry.ResourceDigestGenerator or
- * infrastructure:ResourceDigestGenerator.
*/
public class ResourceDigestGeneratorImpl implements ResourceDigestGenerator
{
@@ -71,8 +69,7 @@
{
int length = stream.read(buffer);
- if (length < 0)
- return;
+ if (length < 0) return;
digest.update(buffer, 0, length);
}
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/ServicesMessages.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/ServicesMessages.java?view=diff&rev=518235&r1=518234&r2=518235
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/ServicesMessages.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/ServicesMessages.java Wed Mar 14 10:47:14 2007
@@ -44,23 +44,21 @@
return MESSAGES.format("duplicate-contribution", conflict, name, existing);
}
- static final String infrastructureModeNotSet()
+ static final String aliasModeNotSet()
{
- return MESSAGES.get("infrastructure-mode-not-set");
+ return MESSAGES.get("alias-mode-not-set");
}
- static final String infrastructurePropertyNotFound(String name, Collection<String> known)
+ static final String aliasPropertyNotFound(String name, Collection<String> known)
{
String knownList = InternalUtils.joinSorted(known);
- return MESSAGES.format("infrastructure-property-not-found", name, knownList);
+ return MESSAGES.format("alias-property-not-found", name, knownList);
}
- static final String infrastructurePropertyWrongType(String name, Object object,
- Class desiredType)
+ static final String aliasPropertyWrongType(String name, Object object, Class desiredType)
{
- return MESSAGES.format("infrastructure-property-wrong-type", name, object, desiredType
- .getName());
+ return MESSAGES.format("alis-property-wrong-type", name, object, desiredType.getName());
}
static final String markupWriterNoCurrentElement()
@@ -395,7 +393,7 @@
static String assetNotCompatible(String path, Class propertyType)
{
- return MESSAGES
- .format("asset-not-compatible", path, ClassFabUtils.toJavaClassName(propertyType));
+ return MESSAGES.format("asset-not-compatible", path, ClassFabUtils
+ .toJavaClassName(propertyType));
}
}
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/test/InternalBaseTestCase.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/test/InternalBaseTestCase.java?view=diff&rev=518235&r1=518234&r2=518235
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/test/InternalBaseTestCase.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/test/InternalBaseTestCase.java Wed Mar 14 10:47:14 2007
@@ -68,7 +68,7 @@
import org.apache.tapestry.runtime.Component;
import org.apache.tapestry.runtime.RenderQueue;
import org.apache.tapestry.services.ComponentClassResolver;
-import org.apache.tapestry.services.Infrastructure;
+import org.apache.tapestry.services.Alias;
import org.apache.tapestry.services.Request;
import org.apache.tapestry.services.TapestryModule;
import org.apache.tapestry.test.TapestryTestCase;
@@ -95,7 +95,7 @@
_registry = builder.build();
- _registry.getService(Infrastructure.class).setMode("servlet");
+ _registry.getService(Alias.class).setMode("servlet");
}
@AfterSuite
Copied: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/Alias.java (from r517898, tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/Infrastructure.java)
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/Alias.java?view=diff&rev=518235&p1=tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/Infrastructure.java&r1=517898&p2=tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/Alias.java&r2=518235
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/Infrastructure.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/Alias.java Wed Mar 14 10:47:14 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.
@@ -12,24 +12,23 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package org.apache.tapestry.services;
-
-import org.apache.tapestry.ioc.ObjectProvider;
-
-/**
- * Primarily, Infrastructure is an ObjectProvider (for the "infrastructure" object provider prefix).
- * However, it has to know what mode it is operating in.
- *
- *
- */
-public interface Infrastructure
-{
- /** Inform the Infrastructure about what mode it is operating in. */
- void setMode(String mode);
-
- /**
- * Returns an object that can provide objects based on contributions into the Infrastructure
- * service.
- */
- ObjectProvider getObjectProvider();
-}
+package org.apache.tapestry.services;
+
+import org.apache.tapestry.ioc.ObjectProvider;
+
+/**
+ * Primarily, the Alias service is an ObjectProvider (for the "alias" object provider prefix).
+ * However, it has to know what mode it is operating in (this allows for spot-overrides of certain
+ * services to adapt to a new environment, such as Portlet).
+ */
+public interface Alias
+{
+ /** Inform the Alias service about what mode it is operating in. */
+ void setMode(String mode);
+
+ /**
+ * Returns an object that can provide objects based on contributions into the Alias (and
+ * AliasOverrides) service.
+ */
+ ObjectProvider getObjectProvider();
+}
Copied: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/AliasContribution.java (from r517898, tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/InfrastructureContribution.java)
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/AliasContribution.java?view=diff&rev=518235&p1=tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/InfrastructureContribution.java&r1=517898&p2=tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/AliasContribution.java&r2=518235
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/InfrastructureContribution.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/AliasContribution.java Wed Mar 14 10:47:14 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.
@@ -12,88 +12,81 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package org.apache.tapestry.services;
-
+package org.apache.tapestry.services;
+
import static org.apache.tapestry.ioc.internal.util.Defense.notBlank;
-
-import java.util.Formatter;
-
+
+import java.util.Formatter;
+
import org.apache.tapestry.ioc.internal.util.InternalUtils;
-
-/**
- * A contribution into the infrastructure configuration.
- * <p>
- * TODO: There might be an order-of-operations issue here. We may need a mechanism like Tapestry 4's
- * infrastructure that defers instantiation of contributed objects until after the Infrastructure
- * service is constructed.
- *
- *
- */
-public final class InfrastructureContribution
-{
- private final String _name;
-
- private final String _mode;
-
- private final Object _object;
-
- /**
- * Conntributes the object with a blank mode.
- */
- public InfrastructureContribution(String name, Object object)
- {
- this(name, "", object);
- }
-
- public InfrastructureContribution(String name, String mode, Object object)
- {
- _name = notBlank(name, "name");
- _mode = mode;
- _object = object;
- }
-
- /**
- * Returns the mode of operation for this instance of Tapestry. Most of the time, this will be
- * the empty string, meaning that the contribution applies to Tapestry is any mode. In other
- * cases, the mode will be "servlet" but may be other modes via add on modules, such as
- * "portlet" or "offline".
- *
- * @return
- */
- public String getMode()
- {
- return _mode;
- }
-
- /**
- * The property name that may be accessed via the Infrastructure service. The combination of
- * name and mode must be unique.
- */
- public String getName()
- {
- return _name;
- }
-
- /** The contributed object, which will be made available. */
- public Object getObject()
- {
- return _object;
- }
-
- @Override
- public String toString()
- {
- StringBuilder buffer = new StringBuilder();
- Formatter formatter = new Formatter(buffer);
-
- formatter.format("<InfrastructureContribution: %s", _name);
-
- if (InternalUtils.isNonBlank(_mode))
- formatter.format(" mode:%s", _mode);
-
- formatter.format(" %s>", _object);
-
- return buffer.toString();
- }
-
-}
+
+/**
+ * A contribution into the {@link Alias} or AliasOverride service configuration.
+ */
+public final class AliasContribution
+{
+ private final String _name;
+
+ private final String _mode;
+
+ private final Object _object;
+
+ /**
+ * Conntributes the object with a blank mode.
+ */
+ public AliasContribution(String name, Object object)
+ {
+ this(name, "", object);
+ }
+
+ public AliasContribution(String name, String mode, Object object)
+ {
+ _name = notBlank(name, "name");
+ _mode = mode;
+ _object = object;
+ }
+
+ /**
+ * Returns the mode of operation for this instance of Tapestry. Most of the time, this will be
+ * the empty string, meaning that the contribution applies to Tapestry is any mode. In other
+ * cases, the mode will be "servlet" but may be other modes via add on modules, such as
+ * "portlet" or "offline".
+ *
+ * @return
+ */
+ public String getMode()
+ {
+ return _mode;
+ }
+
+ /**
+ * The property name that may be accessed via the Alias service. The combination of name and
+ * mode must be unique.
+ */
+ public String getName()
+ {
+ return _name;
+ }
+
+ /** The contributed object, which will be made available. */
+ public Object getObject()
+ {
+ return _object;
+ }
+
+ @Override
+ public String toString()
+ {
+ StringBuilder builder = new StringBuilder();
+ Formatter formatter = new Formatter(builder);
+
+ formatter.format("<AliasContribution: %s", _name);
+
+ if (InternalUtils.isNonBlank(_mode)) formatter.format(" mode:%s", _mode);
+
+ formatter.format(" %s>", _object);
+
+ return builder.toString();
+ }
+
+}
Copied: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/AliasManager.java (from r517898, tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/InfrastructureManager.java)
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/AliasManager.java?view=diff&rev=518235&p1=tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/InfrastructureManager.java&r1=517898&p2=tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/AliasManager.java&r2=518235
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/InfrastructureManager.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/AliasManager.java Wed Mar 14 10:47:14 2007
@@ -17,18 +17,18 @@
import java.util.Map;
/**
- * A thin wrapper around a set of {@link org.apache.tapestry.services.InfrastructureContribution}s.
+ * A thin wrapper around a set of {@link org.apache.tapestry.services.AliasContribution}s.
*/
-public interface InfrastructureManager
+public interface AliasManager
{
/**
- * Filters down the contributions based on the mode. Each contribution will identify a name and
- * object and may identify a mode. Only contributions where the mode is blank or the mode
- * matches the provided mode are returned. Mode specific contributions quietly override
- * non-specific contributions (where the mode is blank).
+ * Filters down the contributions based on the mode. Each {@link AliasContribution contribution}
+ * will identify a name and object and may identify a mode. Only contributions where the mode is
+ * blank or the mode matches the provided mode are returned. Mode specific contributions quietly
+ * override non-specific contributions (where the mode is blank).
*
* @param mode
- * @return
+ * @return case-insensitive map from alias name to alias object
*/
- Map<String, Object> getContributionsForMode(String mode);
+ Map<String, Object> getAliasesForMode(String mode);
}
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/RequestGlobals.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/RequestGlobals.java?view=diff&rev=518235&r1=518234&r2=518235
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/RequestGlobals.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/RequestGlobals.java Wed Mar 14 10:47:14 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.
@@ -34,9 +34,9 @@
void store(Request request, Response response);
- /** Accessible as injected object "infrastructure:Request". */
+ /** Accessible as injected object "alias:Request". */
Request getRequest();
- /** Accessible as injected object "infrastructure:Response". */
+ /** Accessible as injected object "alias:Response". */
Response getResponse();
}
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/TapestryModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/TapestryModule.java?view=diff&rev=518235&r1=518234&r2=518235
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/TapestryModule.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/services/TapestryModule.java Wed Mar 14 10:47:14 2007
@@ -102,8 +102,8 @@
import org.apache.tapestry.internal.services.FieldValidatorSourceImpl;
import org.apache.tapestry.internal.services.FlashPersistentFieldStrategy;
import org.apache.tapestry.internal.services.HeartbeatImpl;
-import org.apache.tapestry.internal.services.InfrastructureImpl;
-import org.apache.tapestry.internal.services.InfrastructureManagerImpl;
+import org.apache.tapestry.internal.services.AliasImpl;
+import org.apache.tapestry.internal.services.AliasManagerImpl;
import org.apache.tapestry.internal.services.InjectAnonymousWorker;
import org.apache.tapestry.internal.services.InjectAssetWorker;
import org.apache.tapestry.internal.services.InjectBlockWorker;
@@ -223,21 +223,21 @@
return new PersistentLocaleImpl(cookies);
}
- public static Infrastructure build(Log log,
+ public static Alias build(Log log,
- @InjectService("InfrastructureOverrides")
- InfrastructureManager overridesManager,
+ @InjectService("AliasOverrides")
+ AliasManager overridesManager,
- Collection<InfrastructureContribution> configuration)
+ Collection<AliasContribution> configuration)
{
- InfrastructureManager manager = new InfrastructureManagerImpl(log, configuration);
+ AliasManager manager = new AliasManagerImpl(log, configuration);
- return new InfrastructureImpl(manager, overridesManager);
+ return new AliasImpl(manager, overridesManager);
}
public static ApplicationStateManager build(
Map<Class, ApplicationStateContribution> configuration,
- @Inject("infrastructure:ApplicationStatePersistenceStrategySource")
+ @Inject("alias:ApplicationStatePersistenceStrategySource")
ApplicationStatePersistenceStrategySource source)
{
return new ApplicationStateManagerImpl(configuration, source);
@@ -260,7 +260,7 @@
}
/** A public service since extensions may provide new persistent strategies. */
- public static PersistentFieldManager build(@Inject("infrastructure:MetaDataLocator")
+ public static PersistentFieldManager build(@Inject("alias:MetaDataLocator")
MetaDataLocator locator,
Map<String, PersistentFieldStrategy> configuration)
@@ -268,10 +268,10 @@
return new PersistentFieldManagerImpl(locator, configuration);
}
- public static FieldValidatorSource build(@Inject("infrastructure:ValidationMessagesSource")
+ public static FieldValidatorSource build(@Inject("alias:ValidationMessagesSource")
ValidationMessagesSource messagesSource,
- @Inject("infrastructure:TypeCoercer")
+ @Inject("alias:TypeCoercer")
TypeCoercer typeCoercer,
@Inject("service:PageRenderSupport")
@@ -322,29 +322,24 @@
}
public static FieldValidatorDefaultSource buildFieldValidatorDefaultSource(
- @Inject("infrastructure:ValidationConstraintGenerator")
+ @Inject("alias:ValidationConstraintGenerator")
ValidationConstraintGenerator validationConstraintGenerator,
- @Inject("infrastructure:FieldValidatorSource")
+ @Inject("alias:FieldValidatorSource")
FieldValidatorSource fieldValidatorSource)
{
return new FieldValidatorDefaultSourceImpl(validationConstraintGenerator,
fieldValidatorSource);
}
- // Yes, you can inject services defined by this module into this module. The service proxy is
- // created without instantiating the module itself. We're careful about making as many
- // service builder and contributor methods static as possible to avoid recursive build
- // exceptions.
-
/**
- * A companion service to {@link #buildInfrastructure(Log, Collection)} whose configuration
- * contribution define spot overrides to specific services.
+ * A companion service to {@linkplain #build(Log, AliasManager, Collection) the Alias service}
+ * whose configuration contribution define spot overrides to specific services.
*/
- public static InfrastructureManager buildInfrastructureOverrides(Log log,
- Collection<InfrastructureContribution> configuration)
+ public static AliasManager buildAliasOverrides(Log log,
+ Collection<AliasContribution> configuration)
{
- return new InfrastructureManagerImpl(log, configuration);
+ return new AliasManagerImpl(log, configuration);
}
@Lifecycle("perthread")
@@ -374,10 +369,10 @@
@InjectService("PropBindingFactory")
BindingFactory propBindingFactory,
- @Inject("infrastructure:FieldValidatorSource")
+ @Inject("alias:FieldValidatorSource")
FieldValidatorSource fieldValidatorSource,
- @Inject("infrastructure:TranslatorSource")
+ @Inject("alias:TranslatorSource")
TranslatorSource translatorSource)
{
configuration.add(TapestryConstants.LITERAL_BINDING_PREFIX, new LiteralBindingFactory());
@@ -442,25 +437,25 @@
@InjectService("InjectionProvider")
InjectionProvider injectionProvider,
- @Inject("infrastructure:Environment")
+ @Inject("alias:Environment")
Environment environment,
- @Inject("infrastructure:ComponentClassResolver")
+ @Inject("alias:ComponentClassResolver")
ComponentClassResolver resolver,
@InjectService("RequestPageCache")
RequestPageCache requestPageCache,
- @Inject("infrastructure:AssetSource")
+ @Inject("alias:AssetSource")
AssetSource assetSource,
@InjectService("SymbolSource")
SymbolSource symbolSource,
- @Inject("infrastructure:BindingSource")
+ @Inject("alias:BindingSource")
BindingSource bindingsource,
- @Inject("infrastructure:ApplicationStateManager")
+ @Inject("alias:ApplicationStateManager")
ApplicationStateManager applicationStateManager)
{
// TODO: Proper scheduling of all of this. Since a given field or method should
@@ -615,16 +610,15 @@
* Contributes pretty much everything in the tapestry module, plus PropertyAccess and
* TypeCoercer.
*/
- public static void contributeInfrastructure(
- Configuration<InfrastructureContribution> configuration,
+ public static void contributeAlias(Configuration<AliasContribution> configuration,
- ServiceLocator locator,
+ ServiceLocator locator,
- @InjectService("TypeCoercer")
- TypeCoercer typeCoercer,
+ @InjectService("TypeCoercer")
+ TypeCoercer typeCoercer,
- @InjectService("PropertyAccess")
- PropertyAccess propertyAccess)
+ @InjectService("PropertyAccess")
+ PropertyAccess propertyAccess)
{
add(
configuration,
@@ -659,8 +653,8 @@
ValidationConstraintGenerator.class,
ValidationMessagesSource.class);
- configuration.add(new InfrastructureContribution("TypeCoercer", typeCoercer));
- configuration.add(new InfrastructureContribution("PropertyAccess", propertyAccess));
+ configuration.add(new AliasContribution("TypeCoercer", typeCoercer));
+ configuration.add(new AliasContribution("PropertyAccess", propertyAccess));
}
/**
@@ -680,37 +674,38 @@
}
/**
- * Contributes the {@link ObjectProvider} provided by {@link Infrastructure#getObjectProvider()}
- * mapped to the provider prefix "infrastructure".
+ * Contributes the {@link ObjectProvider} provided by {@link Alias#getObjectProvider()} mapped
+ * to the provider prefix "alias", and a second provider for assets as "asset".
*/
public static void contributeMasterObjectProvider(
MappedConfiguration<String, ObjectProvider> configuration,
- @InjectService("Infrastructure")
- final Infrastructure infrastructure,
+ @InjectService("Alias")
+ final Alias alias,
@InjectService("AssetObjectProvider")
ObjectProvider assetObjectProvider)
{
- // There's a nasty web of dependencies related to Infrastructure; this wrapper class lets us
- // defer instantiating the Infrastructure implementation just long enough to defuse those
+ // There's a nasty web of dependencies related to Alias; this wrapper class lets us
+ // defer instantiating the Alias service implementation just long enough to defuse those
// dependencies.
ObjectProvider wrapper = new ObjectProvider()
{
public <T> T provide(String expression, Class<T> objectType, ServiceLocator locator)
{
- return infrastructure.getObjectProvider().provide(expression, objectType, locator);
+ return alias.getObjectProvider().provide(expression, objectType, locator);
}
};
// Or you can defuse the dependency by using @InjectService("foo") instead of
// @Inject("service:foo"). The latter requires the MasterObjectProvider, which requires
- // the Infrastructure, which then fails if any contribution
- // to infrastructure makes use of @Inject. However, since its likely that end users will try
+ // the Alias service, which then fails if any contribution
+ // to the Alias service configuration makes use of @Inject. However, since its likely that
+ // end users will try
// to do this, the wrapper has been left in place (it does very little harm).
- configuration.add("infrastructure", wrapper);
+ configuration.add("alias", wrapper);
configuration.add("asset", assetObjectProvider);
}
@@ -724,7 +719,7 @@
@InjectService("Context")
Context context,
- @Inject("infrastructure:RequestExceptionHandler")
+ @Inject("alias:RequestExceptionHandler")
final RequestExceptionHandler exceptionHandler)
{
RequestFilter staticFilesFilter = new StaticFilesFilter(context);
@@ -889,14 +884,14 @@
/**
* Invoked from
- * {@link #contributeInfrastructure(Configuration, ServiceLocator, Request, Response, TypeCoercer)}
- * to contribute services from the tapestry module where the unqualified class name of the
- * service interface matches the unqualified service id. This unqualified name is used as the
- * infrastructure alias.
+ * {@link #contributeAlias(Configuration, ServiceLocator, TypeCoercer, PropertyAccess)} to
+ * contribute services from this module where the unqualified class name of the service
+ * interface matches the service id. This unqualified name is also used as the alias property
+ * name.
*/
@SuppressWarnings("unchecked")
- private static void add(Configuration<InfrastructureContribution> configuration,
- ServiceLocator locator, Class... serviceInterfaces)
+ private static void add(Configuration<AliasContribution> configuration, ServiceLocator locator,
+ Class... serviceInterfaces)
{
for (Class serviceInterface : serviceInterfaces)
{
@@ -904,8 +899,7 @@
Object service = locator.getService(serviceId, serviceInterface);
- InfrastructureContribution contribution = new InfrastructureContribution(serviceId,
- service);
+ AliasContribution contribution = new AliasContribution(serviceId, service);
configuration.add(contribution);
}
@@ -970,10 +964,10 @@
@InjectService("PropertyShadowBuilder")
PropertyShadowBuilder shadowBuilder,
- @Inject("infrastructure:RequestGlobals")
+ @Inject("alias:RequestGlobals")
RequestGlobals requestGlobals,
- @Inject("infrastructure:ApplicationGlobals")
+ @Inject("alias:ApplicationGlobals")
ApplicationGlobals applicationGlobals,
@InjectService("ChainBuilder")
@@ -985,10 +979,10 @@
@InjectService("PageResponseRenderer")
PageResponseRenderer pageResponseRenderer,
- @Inject("infrastructure:Request")
+ @Inject("alias:Request")
Request request,
- @Inject("infrastructure:Environment")
+ @Inject("alias:Environment")
Environment environment,
@InjectService("StrategyBuilder")
@@ -1000,10 +994,10 @@
@InjectService("LinkFactory")
LinkFactory linkFactory,
- @Inject("infrastructure:PropertyConduitSource")
+ @Inject("alias:PropertyConduitSource")
PropertyConduitSource propertyConduitSource,
- @Inject("infrastructure:PropertyAccess")
+ @Inject("alias:PropertyAccess")
PropertyAccess propertyAccess,
@InjectService("ComponentClassFactory")
@@ -1075,7 +1069,7 @@
return service;
}
- public MetaDataLocator build(@Inject("infrastructure:ComponentClassResolver")
+ public MetaDataLocator build(@Inject("alias:ComponentClassResolver")
ComponentClassResolver componentClassResolver,
Map<String, String> configuration)
@@ -1299,7 +1293,7 @@
* The configuration of the model source is a mapping from type to string. The types are
* property types and the values, the strings, represent different type of editors.
*/
- public BeanModelSource build(@Inject("infrastructure:TypeCoercer")
+ public BeanModelSource build(@Inject("alias:TypeCoercer")
TypeCoercer typeCoercer,
@InjectService("DataTypeAnalyzer")
@@ -1341,7 +1335,7 @@
}
public DefaultComponentParameterBindingSource buildDefaultComponentParameterBindingSource(
- @Inject("infrastructure:BindingSource")
+ @Inject("alias:BindingSource")
BindingSource bindingSource)
{
return new DefaultComponentParameterBindingSourceImpl(_propertyAccess, bindingSource);
@@ -1453,7 +1447,7 @@
}
public void contributeMasterDispatcher(OrderedConfiguration<Dispatcher> configuration,
- @Inject("infrastructure:ClasspathAssetAliasManager")
+ @Inject("alias:ClasspathAssetAliasManager")
ClasspathAssetAliasManager aliasManager,
@InjectService("ResourceCache")
@@ -1537,7 +1531,7 @@
@Inject("asset:org/apache/tapestry/field-error-marker.png")
Asset fieldErrorIcon,
- @Inject("infrastructure:ValidationMessagesSource")
+ @Inject("alias:ValidationMessagesSource")
ValidationMessagesSource validationMessagesSource,
@Inject("service:SymbolSource")
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/test/TapestryTestCase.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/test/TapestryTestCase.java?view=diff&rev=518235&r1=518234&r2=518235
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/test/TapestryTestCase.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/test/TapestryTestCase.java Wed Mar 14 10:47:14 2007
@@ -28,6 +28,7 @@
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
+import java.util.Map;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
@@ -62,6 +63,7 @@
import org.apache.tapestry.model.MutableComponentModel;
import org.apache.tapestry.model.ParameterModel;
import org.apache.tapestry.runtime.Component;
+import org.apache.tapestry.services.AliasManager;
import org.apache.tapestry.services.ApplicationStateCreator;
import org.apache.tapestry.services.ApplicationStatePersistenceStrategy;
import org.apache.tapestry.services.ApplicationStatePersistenceStrategySource;
@@ -923,5 +925,10 @@
MethodSignature signature, String id)
{
expect(transformation.getMethodIdentifier(signature)).andReturn(id);
+ }
+
+ protected final void getAliasesForMode(AliasManager manager, String mode, Map<String, Object> configuration)
+ {
+ expect(manager.getAliasesForMode(mode)).andReturn(configuration);
}
}
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/test/pagelevel/PageTester.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/test/pagelevel/PageTester.java?view=diff&rev=518235&r1=518234&r2=518235
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/test/pagelevel/PageTester.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/test/pagelevel/PageTester.java Wed Mar 14 10:47:14 2007
@@ -116,7 +116,7 @@
_localizationSetter = _registry.getService("LocalizationSetter", LocalizationSetter.class);
ApplicationGlobals globals = _registry.getObject(
- "infrastructure:ApplicationGlobals",
+ "alias:ApplicationGlobals",
ApplicationGlobals.class);
globals.store(new ContextForPageTester(_contextPath));
Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/internal/services/ServicesStrings.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/internal/services/ServicesStrings.properties?view=diff&rev=518235&r1=518234&r2=518235
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/internal/services/ServicesStrings.properties (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/resources/org/apache/tapestry/internal/services/ServicesStrings.properties Wed Mar 14 10:47:14 2007
@@ -13,9 +13,9 @@
# limitations under the License.
duplicate-contribution=Contribution %s (as '%s') duplicates existing contribution %s and has been ignored.
-infrastructure-mode-not-set=The infrastructure mode has not been set. Unable to determine the correct set of infrastructure properties.
-infrastructure-property-not-found=No infrastructure property '%s' has been configured. Configured properties are: %s.
-infrastructure-property-wrong-type=Property '%s' (%s) is not assignable to type %s.
+alias-mode-not-set=The Alias service's mode has not been set. Unable to determine the correct set of alias properties.
+alias-property-not-found=No alias property '%s' has been configured. Configured properties are: %s.
+alias-property-wrong-type=Property '%s' (%s) is not assignable to type %s.
markup-writer-no-current-element=This markup writer does not have a current element. \
The current element is established with the first call to element() and is \
maintained across subsequent calls.
Copied: tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/alias.apt (from r517898, tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/infrastructure.apt)
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/alias.apt?view=diff&rev=518235&p1=tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/infrastructure.apt&r1=517898&p2=tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/alias.apt&r2=518235
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/infrastructure.apt (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/alias.apt Wed Mar 14 10:47:14 2007
@@ -1,49 +1,49 @@
----
- Infrastructure and Overrides
+ Aliases and Overrides
----
Introduction
- Tapestry includes an object provider, "infrastructure:", which is used to access
+ Tapestry includes an object provider, using the prefix "alias:", which is used to access
the key built-in services provided by Tapestry. This is desirable, even though the resulting string
is usually longer than the service's normal id.
- In the vast majority of applications developed using Tapestry, the built in set of
+ In the vast majority of applications developed using Tapestry, the built-in set of
services does exactly what you need them to do. However, there are always outliers,
- very special cases that aren't addressed. The infrastructure mechanism includes the ability
- to <<override>> these services. If infrastructure:AssetSource doesn't do quite what you need,
- you will be able to provide your own service and make that known as infrastructure:AssetSource. It will be
+ very special cases that aren't addressed. The alias mechanism includes the ability
+ to <<override>> these services. If alias:AssetSource doesn't do quite what you need,
+ you will be able to provide your own service and make <that> known as alias:AssetSource. It will be
your implementation that is injected into both your own services and components and the
- services built into Tapestry (both public and internal).
-
-infrastructure: object provider
+ services built into Tapestry.
+
+alias: object provider
- The infrastructure
+ The "alias:"
{{{http://tapestry.apache.org/tapestry5/tapestry-ioc/provider.html}object provider}}
is a key element in making Tapestry extensible; it adds a layer of
- indirection between service implementations and their collaborators. Using the infrastructure
+ indirection between service implementations and their collaborators. Using the alias object
provider allows applications to identify and override individual services within Tapestry's
network of services.
- The <expression> for the infrastructure provider is the name of a property. This property is
+ The <expression> for the alias provider is the name of a property. This property is
mapped to a particular service via a <pair> of services. The
- {{{../apidocs/org/apache/tapestry/services/Infrastructure.html}Infrastructure}} service
+ {{{../apidocs/org/apache/tapestry/services/Alias.html}Alias}} service
has a mapped configuration of
- {{{../apidocs/org/apache/tapestry/services/InfrastructureContribution.html}InfrastructureContribution}}s.
+ {{{../apidocs/org/apache/tapestry/services/AliasContribution.html}AliasContribution}}s.
Each contribution is keyed on the property it provides.
- A second service. InfrastructureOverrides, exists
+ A second service. AliasOverrides, exists
to support a second, identical configuration. Any properties contributed here override the normal
Infrastructure properties.
In order to override an individual Tapestry service, all that is necessary is to provide
a new implementation as a new service (with a new service id), and contribute that service into the configuration for
- the InfrastructureOverride service.
+ the AliasOverrides service.
In many cases, the original service can be injected into the new implementation; this must be done
using the original service's service id.
- The following table identifies the services that are available via the infrastructure provider
+ The following table identifies the services that are available via the alias provider
by default:
[AssetSource]
@@ -120,14 +120,15 @@
<Several additional services have been contributed as well, the above documentation is somewhat out of date.>
-Contributing to Infrastructure
+Contributing an Alias
- To contribute a new service to Infrastructure, you must first determine its logical name.
+ To contribute a new service to the Alias service, you must first decide on a logical name. Often, this is the
+ name of the service interface implemented by the service.
You can then contribute into the Infrastructure service's configuration:
+---+
- public static void contributeInfrastructure(@InjectService("MyService") MyService myService,
+ public static void contributeAlias(@InjectService("MyService") MyService myService,
Configuration<InfrastructureContribution> configuration)
{
configuration.add(new InfrastructureContribution("MyName", myService));
@@ -137,11 +138,14 @@
The above example follows a typical pattern; the service to be vended is injected into the contributor method.
A contribution is made providing the name.
-Contributing to Infrastructure Overrides
+ Notice that the contribution doesn't <have> to be a service; you can just instantiate an object inside the
+ contribution method and contribute that.
+
+Contributing to AliasOverrides
To override a service, you need to know its logical name.
- You can then make a contribution to the InfrastructureOverrides service configuration, as described in the previous section.
+ You can then make a contribution to the AliasOverrides service configuration, as described in the previous section.
The object contributed as an override will mask the default contribution.
Modified: tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/inject.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/inject.apt?view=diff&rev=518235&r1=518234&r2=518235
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/inject.apt (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/inject.apt Wed Mar 14 10:47:14 2007
@@ -48,17 +48,17 @@
{{{http://tapestry.apache.org/tapestry5/tapestry-ioc/provider.html}object reference}} used to identify the exact service, or other resource,
to be injected.
- Commonly, the "infrastructure:" prefix is used with the Inject annotation, to indirectly identify services contributed
- into the tapestry.Infrastructure service.
+ Commonly, the "alias:" prefix is used with the Inject annotation, to indirectly identify services contributed
+ into the Alias service.
Example:
+----+
-@Inject("infrastructure:Request")
+@Inject("alias:Request")
private Request _request;
+----+
- Here, a component requires access to the current Request object, which is defined in tapestry.Infrastructure using the key "request".
+ Here, a component requires access to the current Request object, which is defined in Alias services a a property with the key "request".
* Annonymous Injection
Modified: tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/parameters.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/parameters.apt?view=diff&rev=518235&r1=518234&r2=518235
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/parameters.apt (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/parameters.apt Wed Mar 14 10:47:14 2007
@@ -315,7 +315,7 @@
@Inject
private ComponentResources _resources;
- @Inject("infrastructure:BindingSource")
+ @Inject("alias:BindingSource")
private BindingSource _bindingSource;
Binding defaultMessage()
@@ -342,9 +342,6 @@
@Inject
private ComponentResources _resources;
-
- @Inject("infrastructure:BindingSource")
- private BindingSource _bindingSource;
String defaultMessage()
{
Modified: tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/request.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/request.apt?view=diff&rev=518235&r1=518234&r2=518235
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/request.apt (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/request.apt Wed Mar 14 10:47:14 2007
@@ -60,7 +60,7 @@
the request, so that the servlet container can handle the reuest normally.
* ErrorFilter catches uncaught exceptions from the lower levels of Tapestry and presents the exception report page.
- This involves the {{{../apidocs/org/apache/tapestry/services/RequestExceptionHandler.html}infrastructure:RequestExceptionHandler}} service,
+ This involves the {{{../apidocs/org/apache/tapestry/services/RequestExceptionHandler.html}alias:RequestExceptionHandler}} service,
which is responsible for initializing and rendering the
{{{../apidocs/org/apache/tapestry/corelib/pages/ExceptionReport.html}core/ExceptionReport}} page.
@@ -130,10 +130,10 @@
Request Service
The Request service is a
- {{{../ioc/shadow.html}shadow}}
+ {{{http://tapestry.apache.org/tapestry5/tapestry-ioc/shadow.html}shadow}}
of the RequestGlobals services' request property. That is, any methods invoked
on this service are delegated to the request object stored inside the RequestGlobals.
- This service is also accessible with the object reference <<<infrastructure:Request>>>.
+ This service is also accessible with the object reference <<<alias:Request>>>.
Modified: tapestry/tapestry5/tapestry-core/trunk/src/site/site.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/site.xml?view=diff&rev=518235&r1=518234&r2=518235
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/site/site.xml (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/site/site.xml Wed Mar 14 10:47:14 2007
@@ -73,7 +73,7 @@
<item name="Persistent Data" href="guide/persist.html"/>
<item name="Application State" href="guide/appstate.html"/>
<item name="Injection" href="guide/inject.html"/>
- <item name="Infrastructure" href="guide/infrastructure.html"/>
+ <item name="Aliases" href="guide/alias.html"/>
<item name="Configuration" href="guide/conf.html"/>
<item name="Request Processing" href="guide/request.html"/>
<item name="DOM" href="guide/dom.html"/>
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/pages/InjectDemo.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/pages/InjectDemo.java?view=diff&rev=518235&r1=518234&r2=518235
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/pages/InjectDemo.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/pages/InjectDemo.java Wed Mar 14 10:47:14 2007
@@ -24,7 +24,7 @@
public class InjectDemo
{
// Named --- now demonstrating case insensitivity
- @Inject("Infrastructure:request")
+ @Inject("alias:request")
private Request _request;
// Via ComponentResourcesInjectionProvider
Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/pages/Localization.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/pages/Localization.java?view=diff&rev=518235&r1=518234&r2=518235
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/pages/Localization.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/pages/Localization.java Wed Mar 14 10:47:14 2007
@@ -37,7 +37,7 @@
@Inject
private Locale _locale;
- @Inject("infrastructure:Request")
+ @Inject("alias:Request")
private Request _request;
public Locale getLocale()