You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2011/01/04 22:02:38 UTC
svn commit: r1055179 - in /tapestry/tapestry5/trunk:
tapestry-core/src/main/java/org/apache/tapestry5/
tapestry-core/src/main/java/org/apache/tapestry5/internal/
tapestry-core/src/main/java/org/apache/tapestry5/internal/services/
tapestry-core/src/main...
Author: hlship
Date: Tue Jan 4 21:02:38 2011
New Revision: 1055179
URL: http://svn.apache.org/viewvc?rev=1055179&view=rev
Log:
TAP5-1402: Remove deprecated Alias service (which was replaced in 5.1 with the simpler ServiceOverride service)
Removed:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AliasImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AliasManagerImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/Alias.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/AliasContribution.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/AliasManager.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/AliasImplTest.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/AliasManagerImplTest.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/services/AliasContributionTest.java
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/TapestryFilter.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/InternalSymbols.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/TapestryAppInitializer.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/test/PageTesterModule.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/test/PageTester.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/test/TapestryTestCase.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/AppModule.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/TapestryAppInitializerTest.java
tapestry/tapestry5/trunk/tapestry-hibernate/src/main/java/org/apache/tapestry5/hibernate/HibernateModule.java
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/TapestryFilter.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/TapestryFilter.java?rev=1055179&r1=1055178&r2=1055179&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/TapestryFilter.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/TapestryFilter.java Tue Jan 4 21:02:38 2011
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007, 2008, 2009, 2010 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 2009, 2010, 2011 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.
@@ -88,7 +88,7 @@ public class TapestryFilter implements F
String executionMode = System.getProperty("tapestry.execution-mode", "production");
TapestryAppInitializer appInitializer = new TapestryAppInitializer(logger, provider,
- filterName, "servlet", executionMode);
+ filterName, executionMode);
appInitializer.addModules(provideExtraModuleDefs(context));
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/InternalSymbols.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/InternalSymbols.java?rev=1055179&r1=1055178&r2=1055179&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/InternalSymbols.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/InternalSymbols.java Tue Jan 4 21:02:38 2011
@@ -1,4 +1,4 @@
-// Copyright 2009, 2010 The Apache Software Foundation
+// Copyright 2009, 2010, 2011 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.
@@ -17,28 +17,22 @@ package org.apache.tapestry5.internal;
public class InternalSymbols
{
/**
- * The application mode, generally "servlet", used to select the correct contributions to the
- * {@link org.apache.tapestry5.services.Alias} service.
- */
- public static final String ALIAS_MODE = "tapestry.alias-mode";
-
- /**
- * The name of the application (i.e., the name of the application filter). Used, for example, to select additional
- * resources related to the application.
+ * The name of the application (i.e., the name of the application filter). Used, for example, to
+ * select additional resources related to the application.
*/
public static final String APP_NAME = "tapestry.app-name";
/**
- * The application package converted to a path ('.' becomes '/'). Useful for finding resources on the classpath
- * relevant to the application.
+ * The application package converted to a path ('.' becomes '/'). Useful for finding resources
+ * on the classpath relevant to the application.
*
* @since 5.1.0.0
*/
public static final String APP_PACKAGE_PATH = "tapestry.app-package-path";
/**
- * Comma-seperated list of pre-allocated Form component control names. Basically, this exists to work
- * around name collisions on the client side.
+ * Comma-separated list of pre-allocated Form component control names. Basically, this exists to
+ * work around name collisions on the client side.
*
* @since 5.2.0
*/
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/TapestryAppInitializer.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/TapestryAppInitializer.java?rev=1055179&r1=1055178&r2=1055179&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/TapestryAppInitializer.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/TapestryAppInitializer.java Tue Jan 4 21:02:38 2011
@@ -1,10 +1,10 @@
-// Copyright 2006, 2007, 2008, 2009, 2010 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 2009, 2010, 2011 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
-// http://www.apache.org/licenses/LICENSE-2.0
+// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@@ -38,6 +38,7 @@ import java.util.List;
* The application module is identified as <em>package</em>.services.<em>appName</em>Module, where
* <em>package</em> and the <em>appName</em> are specified by the caller.
*/
+@SuppressWarnings("rawtypes")
public class TapestryAppInitializer
{
private final Logger logger;
@@ -46,31 +47,43 @@ public class TapestryAppInitializer
private final String appName;
- private final String aliasMode;
-
private final long startTime;
private final RegistryBuilder builder = new RegistryBuilder();
private long registryCreatedTime;
+
private Registry registry;
/**
* @param logger
* logger for output confirmation
- * @param appProvider
- * provides symbols for the application (normally, from the ServletContext init
- * parameters)
+ * @param appPackage
+ * root package name to search for pages and components
* @param appName
* the name of the application (i.e., the name of the application servlet)
* @param aliasMode
- * the mode, used by the {@link org.apache.tapestry5.services.Alias} service,
- * normally "servlet"
+ * ignored (was used in 5.2)
+ * @deprecated Use {@link #TapestryAppInitializer(Logger,String,String)} instead. To be removed
+ * in 5.4.
*/
public TapestryAppInitializer(Logger logger, String appPackage, String appName, String aliasMode)
{
- this(logger, new SingleKeySymbolProvider(InternalConstants.TAPESTRY_APP_PACKAGE_PARAM,
- appPackage), appName, aliasMode, null);
+ this(logger, appPackage, appName);
+ }
+
+ /**
+ * @param logger
+ * logger for output confirmation
+ * @param appPackage
+ * root package name to search for pages and components
+ * @param appName
+ * the name of the application (i.e., the name of the application servlet)
+ */
+ public TapestryAppInitializer(Logger logger, String appPackage, String appName)
+ {
+ this(logger, new SingleKeySymbolProvider(InternalConstants.TAPESTRY_APP_PACKAGE_PARAM, appPackage), appName,
+ null);
}
/**
@@ -82,16 +95,19 @@ public class TapestryAppInitializer
* @param appName
* the name of the application (i.e., the name of the application servlet)
* @param aliasMode
- * the mode, used by the {@link org.apache.tapestry5.services.Alias} service,
- * normally "servlet"
- * @deprecated Use
- * {@link #TapestryAppInitializer(Logger, SymbolProvider, String, String, String)}
- * instead
+ * ignored (was used in 5.2 and earlier)
+ * @param executionModes
+ * an optional, comma-separated list of execution modes, each of which is used
+ * to find a list of additional module classes to load (key
+ * <code>tapestry.<em>name</em>-modules</code> in appProvider, i.e., the servlet
+ * context)
+ * @deprecated Use {@link #TapestryAppInitializer(Logger,SymbolProvider,String,String)} instead.
+ * To be removed in 5.4.
*/
- public TapestryAppInitializer(Logger logger, SymbolProvider appProvider, String appName,
- String aliasMode)
+ public TapestryAppInitializer(Logger logger, SymbolProvider appProvider, String appName, String aliasMode,
+ String executionModes)
{
- this(logger, appProvider, appName, aliasMode, null);
+ this(logger, appProvider, appName, executionModes);
}
/**
@@ -102,31 +118,24 @@ public class TapestryAppInitializer
* parameters)
* @param appName
* the name of the application (i.e., the name of the application servlet)
- * @param aliasMode
- * the mode, used by the {@link org.apache.tapestry5.services.Alias} service,
- * normally "servlet"
* @param executionModes
- * an optional, comma-seperated list of execution modes, each of which is used
+ * an optional, comma-separated list of execution modes, each of which is used
* to find a list of additional module classes to load (key
* <code>tapestry.<em>name</em>-modules</code> in appProvider, i.e., the servlet
* context)
*/
- public TapestryAppInitializer(Logger logger, SymbolProvider appProvider, String appName,
- String aliasMode, String executionModes)
+ public TapestryAppInitializer(Logger logger, SymbolProvider appProvider, String appName, String executionModes)
{
this.logger = logger;
this.appProvider = appProvider;
- String appPackage = appProvider
- .valueForSymbol(InternalConstants.TAPESTRY_APP_PACKAGE_PARAM);
+ String appPackage = appProvider.valueForSymbol(InternalConstants.TAPESTRY_APP_PACKAGE_PARAM);
this.appName = appName;
- this.aliasMode = aliasMode;
startTime = System.currentTimeMillis();
- if (!Boolean.parseBoolean(appProvider
- .valueForSymbol(InternalConstants.DISABLE_DEFAULT_MODULES_PARAM)))
+ if (!Boolean.parseBoolean(appProvider.valueForSymbol(InternalConstants.DISABLE_DEFAULT_MODULES_PARAM)))
{
IOCUtilities.addDefaultModules(builder);
}
@@ -135,13 +144,13 @@ public class TapestryAppInitializer
addModules(TapestryModule.class);
- String className = appPackage + ".services." + InternalUtils.capitalize(this.appName)
- + "Module";
+ String className = appPackage + ".services." + InternalUtils.capitalize(this.appName) + "Module";
try
{
// This class is possibly loaded by a parent class loader of the application class
- // loader. The context class loader should have the appropriate view to the module class,
+ // loader. The context class loader should have the appropriate view to the module
+ // class,
// if any.
Class moduleClass = Thread.currentThread().getContextClassLoader().loadClass(className);
@@ -189,22 +198,15 @@ public class TapestryAppInitializer
private void addSyntheticSymbolSourceModule(String appPackage)
{
ContributionDef appPathContribution = new SyntheticSymbolSourceContributionDef("AppPath",
- new SingleKeySymbolProvider(InternalSymbols.APP_PACKAGE_PATH, appPackage.replace(
- '.', '/')));
-
- ContributionDef symbolSourceContribution = new SyntheticSymbolSourceContributionDef(
- "ServletContext", appProvider, "before:ApplicationDefaults");
+ new SingleKeySymbolProvider(InternalSymbols.APP_PACKAGE_PATH, appPackage.replace('.', '/')));
- ContributionDef aliasModeContribution = new SyntheticSymbolSourceContributionDef(
- "AliasMode", new SingleKeySymbolProvider(InternalSymbols.ALIAS_MODE, aliasMode),
- "before:ServletContext");
+ ContributionDef symbolSourceContribution = new SyntheticSymbolSourceContributionDef("ServletContext",
+ appProvider, "before:ApplicationDefaults");
ContributionDef appNameContribution = new SyntheticSymbolSourceContributionDef("AppName",
- new SingleKeySymbolProvider(InternalSymbols.APP_NAME, appName),
- "before:ServletContext");
+ new SingleKeySymbolProvider(InternalSymbols.APP_NAME, appName), "before:ServletContext");
- builder.add(new SyntheticModuleDef(symbolSourceContribution, aliasModeContribution,
- appNameContribution, appPathContribution));
+ builder.add(new SyntheticModuleDef(symbolSourceContribution, appNameContribution, appPathContribution));
}
public Registry createRegistry()
@@ -226,9 +228,8 @@ public class TapestryAppInitializer
Formatter f = new Formatter(buffer);
f.format("Application '%s' (Tapestry version %s).\n\n"
- + "Startup time: %,d ms to build IoC Registry, %,d ms overall.\n\n"
- + "Startup services status:\n", appName, source
- .valueForSymbol(SymbolConstants.TAPESTRY_VERSION), registryCreatedTime - startTime,
+ + "Startup time: %,d ms to build IoC Registry, %,d ms overall.\n\n" + "Startup services status:\n",
+ appName, source.valueForSymbol(SymbolConstants.TAPESTRY_VERSION), registryCreatedTime - startTime,
toFinish - startTime);
int unrealized = 0;
@@ -260,8 +261,8 @@ public class TapestryAppInitializer
f.format(formatString, activity.getServiceId(), activity.getStatus().name());
}
- f.format("\n%4.2f%% unrealized services (%d/%d)\n", 100. * unrealized
- / serviceActivity.size(), unrealized, serviceActivity.size());
+ f.format("\n%4.2f%% unrealized services (%d/%d)\n", 100. * unrealized / serviceActivity.size(), unrealized,
+ serviceActivity.size());
logger.info(buffer.toString());
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/test/PageTesterModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/test/PageTesterModule.java?rev=1055179&r1=1055178&r2=1055179&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/test/PageTesterModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/test/PageTesterModule.java Tue Jan 4 21:02:38 2011
@@ -1,10 +1,10 @@
-// Copyright 2007, 2008, 2009 The Apache Software Foundation
+// Copyright 2007, 2008, 2009, 2010, 2011 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
-// http://www.apache.org/licenses/LICENSE-2.0
+// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@@ -14,17 +14,25 @@
package org.apache.tapestry5.internal.test;
-import org.apache.tapestry5.SymbolConstants;
import org.apache.tapestry5.internal.services.CookieSink;
import org.apache.tapestry5.internal.services.CookieSource;
-import org.apache.tapestry5.ioc.*;
-import org.apache.tapestry5.services.*;
+import org.apache.tapestry5.ioc.MappedConfiguration;
+import org.apache.tapestry5.ioc.OrderedConfiguration;
+import org.apache.tapestry5.ioc.ServiceBinder;
+import org.apache.tapestry5.ioc.annotations.Contribute;
+import org.apache.tapestry5.ioc.annotations.Local;
+import org.apache.tapestry5.ioc.services.ServiceOverride;
+import org.apache.tapestry5.services.MarkupRendererFilter;
+import org.apache.tapestry5.services.Request;
+import org.apache.tapestry5.services.RequestFilter;
+import org.apache.tapestry5.services.Response;
import org.apache.tapestry5.test.PageTester;
/**
- * Used in conjuction with {@link PageTester} to mock up and/or stub out portions of Tapestry that need to be handled
- * differently when testing.
+ * Used in conjunction with {@link PageTester} to mock up and/or stub out portions of Tapestry that
+ * need to be handled differently when testing.
*/
+@SuppressWarnings("rawtypes")
public class PageTesterModule
{
public static final String TEST_MODE = "test";
@@ -35,35 +43,18 @@ public class PageTesterModule
binder.bind(TestableResponse.class, TestableResponseImpl.class);
}
- public static void contributeAlias(Configuration<AliasContribution> configuration, ObjectLocator locator)
+ @Contribute(ServiceOverride.class)
+ public static void setupTestableOverrides(MappedConfiguration<Class, Object> configuration, @Local
+ TestableRequest request, @Local
+ TestableResponse response)
{
- alias(configuration, locator, Request.class, "TestableRequest");
- alias(configuration, locator, Response.class, "TestableResponse");
+ configuration.add(Request.class, request);
+ configuration.add(Response.class, response);
TestableCookieSinkSource cookies = new TestableCookieSinkSource();
- alias(configuration, CookieSink.class, cookies);
- alias(configuration, CookieSource.class, cookies);
- }
-
- private static <T> void alias(Configuration<AliasContribution> configuration, ObjectLocator locator,
- Class<T> serviceClass, String serviceId)
- {
- T service = locator.getService(serviceId, serviceClass);
-
- alias(configuration, serviceClass, service);
- }
-
- private static <T> void alias(Configuration<AliasContribution> configuration, Class<T> serviceClass, T service)
- {
- AliasContribution<T> contribution = AliasContribution.create(serviceClass, TEST_MODE, service);
-
- configuration.add(contribution);
- }
-
- public static void contributeFactoryDefaults(MappedConfiguration<String, String> configuration)
- {
- configuration.override(SymbolConstants.FORCE_ABSOLUTE_URIS, "true");
+ configuration.add(CookieSink.class, cookies);
+ configuration.add(CookieSource.class, cookies);
}
public static void contributeRequestHandler(OrderedConfiguration<RequestFilter> configuration)
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java?rev=1055179&r1=1055178&r2=1055179&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java Tue Jan 4 21:02:38 2011
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007, 2008, 2009, 2010 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 2009, 2010, 2011 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.
@@ -142,8 +142,6 @@ import org.slf4j.Logger;
/**
* The root module for Tapestry.
*/
-@SuppressWarnings(
-{ "JavaDoc" })
@Marker(Core.class)
@SubModule(InternalModule.class)
public final class TapestryModule
@@ -355,7 +353,6 @@ public final class TapestryModule
binder.bind(ContextValueEncoder.class, ContextValueEncoderImpl.class);
binder.bind(BaseURLSource.class, BaseURLSourceImpl.class);
binder.bind(BeanBlockOverrideSource.class, BeanBlockOverrideSourceImpl.class);
- binder.bind(AliasManager.class, AliasManagerImpl.class).withId("AliasOverrides");
binder.bind(HiddenFieldLocationRules.class, HiddenFieldLocationRulesImpl.class);
binder.bind(PageDocumentGenerator.class, PageDocumentGeneratorImpl.class);
binder.bind(ResponseRenderer.class, ResponseRendererImpl.class);
@@ -397,22 +394,6 @@ public final class TapestryModule
//
// ========================================================================
- @PreventServiceDecoration
- public static Alias buildAlias(Logger logger,
-
- @Symbol(InternalSymbols.ALIAS_MODE)
- String mode,
-
- @InjectService("AliasOverrides")
- AliasManager overridesManager,
-
- Collection<AliasContribution> configuration)
- {
- AliasManager manager = new AliasManagerImpl(logger, configuration);
-
- return new AliasImpl(manager, mode, overridesManager);
- }
-
// ========================================================================
//
// Service Contribution Methods (static)
@@ -543,26 +524,31 @@ public final class TapestryModule
* <dt>Persist</dt>
* <dd>Allows fields to store their their value persistently between requests</dd>
* <dt>Parameter</dt>
- * <dd>Identifies parameters based on the {@link org.apache.tapestry5.annotations.Parameter} annotation</dd>
+ * <dd>Identifies parameters based on the {@link org.apache.tapestry5.annotations.Parameter}
+ * annotation</dd>
* <dt>Component</dt>
- * <dd>Defines embedded components based on the {@link org.apache.tapestry5.annotations.Component} annotation</dd>
+ * <dd>Defines embedded components based on the
+ * {@link org.apache.tapestry5.annotations.Component} annotation</dd>
* <dt>Mixin</dt>
* <dd>Adds a mixin as part of a component's implementation</dd>
* <dt>Environment</dt>
- * <dd>Allows fields to contain values extracted from the {@link org.apache.tapestry5.services.Environment} service</dd>
+ * <dd>Allows fields to contain values extracted from the
+ * {@link org.apache.tapestry5.services.Environment} service</dd>
* <dt>Inject</dt>
- * <dd>Used with the {@link org.apache.tapestry5.ioc.annotations.Inject} annotation, when a value is supplied</dd>
+ * <dd>Used with the {@link org.apache.tapestry5.ioc.annotations.Inject} annotation, when a
+ * value is supplied</dd>
* <dt>InjectService</dt>
* <dd>Handles the {@link org.apache.tapestry5.ioc.annotations.InjectService} annotation</dd>
* <dt>InjectPage</dt>
- * <dd>Adds code to allow access to other pages via the {@link org.apache.tapestry5.annotations.InjectPage} field
- * annotation</dd>
+ * <dd>Adds code to allow access to other pages via the
+ * {@link org.apache.tapestry5.annotations.InjectPage} field annotation</dd>
* <dt>InjectBlock</dt>
* <dd>Allows a block from the template to be injected into a field</dd>
* <dt>IncludeStylesheet</dt>
* <dd>Supports the {@link org.apache.tapestry5.annotations.IncludeStylesheet} annotation</dd>
* <dt>IncludeJavaScriptLibrary</dt>
- * <dd>Supports the {@link org.apache.tapestry5.annotations.IncludeJavaScriptLibrary} annotation</dd>
+ * <dd>Supports the {@link org.apache.tapestry5.annotations.IncludeJavaScriptLibrary} annotation
+ * </dd>
* <dt>Import</dt>
* <dd>Supports the {@link Import} annotation</dd>
* <dt>SupportsInformalParameters</dt>
@@ -578,10 +564,12 @@ public final class TapestryModule
* <dt>RenderPhase</dt>
* <dd>Link in render phaes methods</dd>
* <dt>InvokePostRenderCleanupOnResources</dt>
- * <dd>Makes sure {@link org.apache.tapestry5.internal.InternalComponentResources#postRenderCleanup()} is invoked
- * after a component finishes rendering</dd>
+ * <dd>Makes sure
+ * {@link org.apache.tapestry5.internal.InternalComponentResources#postRenderCleanup()} is
+ * invoked after a component finishes rendering</dd>
* <dt>GenerateAccessors</dt>
- * <dd>Generates accessor methods if {@link org.apache.tapestry5.annotations.Property} annotation is present</dd>
+ * <dd>Generates accessor methods if {@link org.apache.tapestry5.annotations.Property}
+ * annotation is present</dd>
* <dt>Cached</dt>
* <dd>Checks for the {@link org.apache.tapestry5.annotations.Cached} annotation</dd>
* <dt>Log</dt>
@@ -805,10 +793,11 @@ public final class TapestryModule
* <dt>CommonResources</dt>
* <dd>access to properties of resources (log, messages, etc.)</dd>
* <dt>Asset</dt>
- * <dd>injection of assets (triggered via {@link Path} annotation), with the path relative to the component class</dd>
+ * <dd>injection of assets (triggered via {@link Path} annotation), with the path relative to
+ * the component class</dd>
* <dt>Service</dt>
- * <dd>ordered last, for use when Inject is present and nothing else works, matches field type against Tapestry IoC
- * services</dd>
+ * <dd>ordered last, for use when Inject is present and nothing else works, matches field type
+ * against Tapestry IoC services</dd>
* </dl>
*/
public static void contributeInjectionProvider(OrderedConfiguration<InjectionProvider> configuration,
@@ -843,9 +832,6 @@ public final class TapestryModule
/**
* Contributes two object providers:
* <dl>
- * <dt>Alias</dt>
- * <dd>Searches by type among {@linkplain AliasContribution
- * contributions} to the {@link Alias} service</dd>
* <dt>Asset
* <dt>
* <dd>Checks for the {@link Path} annotation, and injects an {@link Asset}</dd>
@@ -857,32 +843,11 @@ public final class TapestryModule
*/
public static void contributeMasterObjectProvider(OrderedConfiguration<ObjectProvider> configuration,
- @Local
- final Alias alias,
-
@InjectService("AssetObjectProvider")
ObjectProvider assetObjectProvider,
ObjectLocator locator)
{
- // 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. The @Local annotation prevents a recursive call through
- // the MasterObjectProvider to resolve the Alias service itself; that is
- // MasterObjectProvider gets built using this proxy, then the proxy will trigger the
- // construction of AliasImpl (which itself needs MasterObjectProvider to resolve some
- // dependencies).
-
- ObjectProvider wrapper = new ObjectProvider()
- {
- public <T> T provide(Class<T> objectType, AnnotationProvider annotationProvider, ObjectLocator locator)
- {
- return alias.getObjectProvider().provide(objectType, annotationProvider, locator);
- }
- };
-
- configuration.add("Alias", wrapper, "after:ServiceOverride");
-
configuration.add("Asset", assetObjectProvider, "before:AnnotationBasedContributions");
configuration.add("Service", new ServiceAnnotationObjectProvider(), "before:AnnotationBasedContributions");
@@ -895,11 +860,11 @@ public final class TapestryModule
/**
* <dl>
* <dt>StoreIntoGlobals</dt>
- * <dd>Stores the request and response into {@link org.apache.tapestry5.services.RequestGlobals} at the start of the
- * pipeline</dd>
+ * <dd>Stores the request and response into {@link org.apache.tapestry5.services.RequestGlobals}
+ * at the start of the pipeline</dd>
* <dt>IgnoredPaths</dt>
- * <dd>Identifies requests that are known (via the IgnoredPathsFilter service's configuration) to be mapped to other
- * applications</dd>
+ * <dd>Identifies requests that are known (via the IgnoredPathsFilter service's configuration)
+ * to be mapped to other applications</dd>
* <dt>GZip</dt>
* <dd>Handles GZIP compression of response streams (if supported by client)</dd>
*/
@@ -936,17 +901,18 @@ public final class TapestryModule
* Continues a number of filters into the RequestHandler service:
* <dl>
* <dt>StaticFiles</dt>
- * <dd>Checks to see if the request is for an actual file, if so, returns true to let the servlet container process
- * the request</dd>
+ * <dd>Checks to see if the request is for an actual file, if so, returns true to let the
+ * servlet container process the request</dd>
* <dt>CheckForUpdates</dt>
- * <dd>Periodically fires events that checks to see if the file system sources for any cached data has changed (see
- * {@link org.apache.tapestry5.internal.services.CheckForUpdatesFilter}).
+ * <dd>Periodically fires events that checks to see if the file system sources for any cached
+ * data has changed (see {@link org.apache.tapestry5.internal.services.CheckForUpdatesFilter}).
* <dt>ErrorFilter</dt>
- * <dd>Catches request errors and lets the {@link org.apache.tapestry5.services.RequestExceptionHandler} handle them
- * </dd>
+ * <dd>Catches request errors and lets the
+ * {@link org.apache.tapestry5.services.RequestExceptionHandler} handle them</dd>
* <dt>StoreIntoGlobals</dt>
- * <dd>Stores the request and response into the {@link org.apache.tapestry5.services.RequestGlobals} service (this
- * is repeated at the end of the pipeline, in case any filter substitutes the request or response).
+ * <dd>Stores the request and response into the
+ * {@link org.apache.tapestry5.services.RequestGlobals} service (this is repeated at the end of
+ * the pipeline, in case any filter substitutes the request or response).
* </dl>
*/
public void contributeRequestHandler(OrderedConfiguration<RequestFilter> configuration, Context context,
@@ -1311,9 +1277,9 @@ public final class TapestryModule
* the chain is responsible for ordinary
* property names (and property paths).
* <p/>
- * This mechanism has been replaced in 5.1 with a more sophisticated parser based on ANTLR. See <a
- * href="https://issues.apache.org/jira/browse/TAP5-79">TAP5-79</a> for details. There are no longer any built-in
- * contributions to the configuration.
+ * This mechanism has been replaced in 5.1 with a more sophisticated parser based on ANTLR. See
+ * <a href="https://issues.apache.org/jira/browse/TAP5-79">TAP5-79</a> for details. There are no
+ * longer any built-in contributions to the configuration.
*
* @param configuration
* contributions of special factories for some constants, each
@@ -1381,7 +1347,8 @@ public final class TapestryModule
}
/**
- * Builds a proxy to the current {@link JavaScriptSupport} inside this thread's {@link Environment}.
+ * Builds a proxy to the current {@link JavaScriptSupport} inside this thread's
+ * {@link Environment}.
*
* @since 5.2.0
*/
@@ -1391,7 +1358,8 @@ public final class TapestryModule
}
/**
- * Builds a proxy to the current {@link org.apache.tapestry5.services.ClientBehaviorSupport} inside this
+ * Builds a proxy to the current {@link org.apache.tapestry5.services.ClientBehaviorSupport}
+ * inside this
* thread's {@link org.apache.tapestry5.services.Environment}.
*
* @since 5.1.0.1
@@ -1449,7 +1417,8 @@ public final class TapestryModule
}
/**
- * Initializes the application, using a pipeline of {@link org.apache.tapestry5.services.ApplicationInitializer}s.
+ * Initializes the application, using a pipeline of
+ * {@link org.apache.tapestry5.services.ApplicationInitializer}s.
*/
@Marker(Primary.class)
public ApplicationInitializer buildApplicationInitializer(Logger logger,
@@ -1651,7 +1620,8 @@ public final class TapestryModule
/**
* The MarkupRenderer service is used to render a full page as markup.
- * Supports an ordered configuration of {@link org.apache.tapestry5.services.MarkupRendererFilter}s.
+ * Supports an ordered configuration of
+ * {@link org.apache.tapestry5.services.MarkupRendererFilter}s.
*/
public MarkupRenderer buildMarkupRenderer(Logger logger, @Autobuild
MarkupRendererTerminator terminator, List<MarkupRendererFilter> configuration)
@@ -1663,10 +1633,11 @@ public final class TapestryModule
/**
* A wrapper around {@link org.apache.tapestry5.internal.services.PageRenderQueue} used for
* partial page renders.
- * Supports an ordered configuration of {@link org.apache.tapestry5.services.PartialMarkupRendererFilter}s.
+ * Supports an ordered configuration of
+ * {@link org.apache.tapestry5.services.PartialMarkupRendererFilter}s.
*
- * @see #contributePartialMarkupRenderer(org.apache.tapestry5.ioc.OrderedConfiguration, org.apache.tapestry5.Asset,
- * org.apache.tapestry5.ioc.services.SymbolSource, AssetSource)
+ * @see #contributePartialMarkupRenderer(org.apache.tapestry5.ioc.OrderedConfiguration,
+ * org.apache.tapestry5.Asset, org.apache.tapestry5.ioc.services.SymbolSource, AssetSource)
*/
public PartialMarkupRenderer buildPartialMarkupRenderer(Logger logger,
List<PartialMarkupRendererFilter> configuration, @Autobuild
@@ -1703,7 +1674,8 @@ public final class TapestryModule
/**
* Builds the action request handler for Ajax requests, based on a
* {@linkplain org.apache.tapestry5.ioc.services.PipelineBuilder
- * pipeline} around {@link org.apache.tapestry5.internal.services.AjaxComponentEventRequestHandler} . Filters on
+ * pipeline} around
+ * {@link org.apache.tapestry5.internal.services.AjaxComponentEventRequestHandler} . Filters on
* the
* request handler are supported here as well.
*/
@@ -1755,11 +1727,11 @@ public final class TapestryModule
* <dt>String</dt>
* <dd>Sends a page render redirect</dd>
* <dt>Class</dt>
- * <dd>Interpreted as the class name of a page, sends a page render render redirect (this is more refactoring safe
- * than the page name)</dd>
+ * <dd>Interpreted as the class name of a page, sends a page render render redirect (this is
+ * more refactoring safe than the page name)</dd>
* <dt>{@link Component}</dt>
- * <dd>A page's root component (though a non-root component will work, but will generate a warning). A direct to the
- * containing page is sent.</dd>
+ * <dd>A page's root component (though a non-root component will work, but will generate a
+ * warning). A direct to the containing page is sent.</dd>
* <dt>{@link org.apache.tapestry5.StreamResponse}</dt>
* <dd>The stream response is sent as the actual reply.</dd>
* <dt>URL</dt>
@@ -1815,13 +1787,16 @@ public final class TapestryModule
* <dt>{@link RenderCommand}</dt>
* <dd>Typically, a {@link org.apache.tapestry5.Block}</dd>
* <dt>{@link org.apache.tapestry5.annotations.Component}</dt>
- * <dd>Renders the component and its body (unless its a page, in which case a redirect JSON response is sent)</dd>
- * <dt>{@link org.apache.tapestry5.json.JSONObject} or {@link org.apache.tapestry5.json.JSONArray}</dt>
+ * <dd>Renders the component and its body (unless its a page, in which case a redirect JSON
+ * response is sent)</dd>
+ * <dt>{@link org.apache.tapestry5.json.JSONObject} or
+ * {@link org.apache.tapestry5.json.JSONArray}</dt>
* <dd>The JSONObject is returned as a text/javascript response</dd>
* <dt>{@link org.apache.tapestry5.StreamResponse}</dt>
* <dd>The stream response is sent as the actual response</dd>
* <dt>String</dt>
- * <dd>Interprets the value as a logical page name and sends a client response to redirect to that page</dd>
+ * <dd>Interprets the value as a logical page name and sends a client response to redirect to
+ * that page</dd>
* <dt>{@link org.apache.tapestry5.Link}</dt>
* <dd>Sends a JSON response to redirect to the link</dd>
* <dt>{@link Class}</dt>
@@ -1830,9 +1805,10 @@ public final class TapestryModule
* <dd>Sends a single JSON response to update the content of multiple zones
* </dl>
* <p>
- * In most cases, when you want to support a new type, you should convert it to one of the built-in supported types
- * (such as {@link RenderCommand}. You can then inject the master AjaxComponentEventResultProcessor (use the
- * {@link Ajax} marker annotation) and delegate to it.
+ * In most cases, when you want to support a new type, you should convert it to one of the
+ * built-in supported types (such as {@link RenderCommand}. You can then inject the master
+ * AjaxComponentEventResultProcessor (use the {@link Ajax} marker annotation) and delegate to
+ * it.
*/
@Contribute(ComponentEventResultProcessor.class)
@Ajax
@@ -1860,8 +1836,8 @@ public final class TapestryModule
* <dt>Asset</dt>
* <dd>Provides access to assets (context, classpath and virtual) via {@link AssetDispatcher}</dd>
* <dt>PageRender</dt>
- * <dd>Identifies the {@link org.apache.tapestry5.services.PageRenderRequestParameters} and forwards onto
- * {@link PageRenderRequestHandler}</dd>
+ * <dd>Identifies the {@link org.apache.tapestry5.services.PageRenderRequestParameters} and
+ * forwards onto {@link PageRenderRequestHandler}</dd>
* <dt>ComponentEvent</dt>
* <dd>Identifies the {@link ComponentEventRequestParameters} and forwards onto the
* {@link ComponentEventRequestHandler}</dd>
@@ -1892,9 +1868,9 @@ public final class TapestryModule
/**
* Contributes a default object renderer for type Object, plus specialized
- * renderers for {@link org.apache.tapestry5.services.Request}, {@link org.apache.tapestry5.ioc.Location},
- * {@link org.apache.tapestry5.ComponentResources}, {@link org.apache.tapestry5.EventContext},
- * {@link AvailableValues},
+ * renderers for {@link org.apache.tapestry5.services.Request},
+ * {@link org.apache.tapestry5.ioc.Location}, {@link org.apache.tapestry5.ComponentResources},
+ * {@link org.apache.tapestry5.EventContext}, {@link AvailableValues},
* List, and Object[].
*/
@SuppressWarnings("unchecked")
@@ -1931,8 +1907,8 @@ public final class TapestryModule
}
/**
- * Adds page render filters, each of which provides an {@link org.apache.tapestry5.annotations.Environmental}
- * service. Filters
+ * Adds page render filters, each of which provides an
+ * {@link org.apache.tapestry5.annotations.Environmental} service. Filters
* often provide {@link org.apache.tapestry5.annotations.Environmental} services needed by
* components as they render.
* <dl>
@@ -2280,6 +2256,7 @@ public final class TapestryModule
configuration.add("Default", "org/apache/tapestry5/internal/ValidationMessages", "before:*");
}
+ @SuppressWarnings("rawtypes")
public static ValueEncoderSource buildValueEncoderSource(Map<Class, ValueEncoderFactory> configuration,
@ComponentClasses
InvalidationEventHub hub)
@@ -2299,7 +2276,7 @@ public final class TapestryModule
* <li>Enum
* </ul>
*/
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("all")
public static void contributeValueEncoderSource(MappedConfiguration<Class, ValueEncoderFactory> configuration)
{
configuration.addInstance(Object.class, TypeCoercedValueEncoderFactory.class);
@@ -2424,16 +2401,11 @@ public final class TapestryModule
configuration.add(SymbolConstants.FORM_CLIENT_LOGIC_ENABLED, "true");
// This is designed to make it easy to keep synchronized with
- // script.aculo.ous. As we
- // support a new version, we create a new folder, and update the path
- // entry. We can then
- // delete the old version folder (or keep it around). This should be
- // more manageable than
- // overwriting the local copy with updates (it's too easy for files
- // deleted between scriptaculous
- // releases to be accidentally left lying around). There's also a
- // ClasspathAliasManager
- // contribution based on the path.
+ // script.aculo.ous. As we support a new version, we create a new folder, and update the
+ // path entry. We can then delete the old version folder (or keep it around). This should
+ // be more manageable than overwriting the local copy with updates (it's too easy for
+ // files deleted between scriptaculous releases to be accidentally left lying around).
+ // There's also a ClasspathAliasManager contribution based on the path.
configuration.add(SymbolConstants.SCRIPTACULOUS, "classpath:${tapestry.scriptaculous.path}");
configuration.add("tapestry.scriptaculous.path", "org/apache/tapestry5/scriptaculous_1_8_2");
@@ -2476,7 +2448,6 @@ public final class TapestryModule
configuration.add(InternalSymbols.PRE_SELECTED_FORM_NAMES, "reset,submit,select,id,method,action,onsubmit");
- configuration.add(InternalSymbols.ALIAS_MODE, "servlet");
configuration.add(SymbolConstants.COMPONENT_RENDER_TRACING_ENABLED, "false");
}
@@ -2509,7 +2480,8 @@ public final class TapestryModule
}
/**
- * Adds a listener to the {@link org.apache.tapestry5.internal.services.ComponentInstantiatorSource} that clears the
+ * Adds a listener to the
+ * {@link org.apache.tapestry5.internal.services.ComponentInstantiatorSource} that clears the
* {@link PropertyAccess} and {@link TypeCoercer} caches on
* a class loader invalidation. In addition, forces the
* realization of {@link ComponentClassResolver} at startup.
@@ -2560,11 +2532,12 @@ public final class TapestryModule
* Contributes filters:
* <dl>
* <dt>Ajax</dt>
- * <dd>Determines if the request is Ajax oriented, and redirects to an alternative handler if so</dd>
+ * <dd>Determines if the request is Ajax oriented, and redirects to an alternative handler if so
+ * </dd>
* <dt>ImmediateRender</dt>
* <dd>When {@linkplain SymbolConstants#SUPPRESS_REDIRECT_FROM_ACTION_REQUESTS
- * immediate action response rendering} is enabled, generates the markup response (instead of a page redirect
- * response, which is the normal behavior)</dd>
+ * immediate action response rendering} is enabled, generates the markup response (instead of a
+ * page redirect response, which is the normal behavior)</dd>
* <dt>Secure</dt>
* <dd>Sends a redirect if an non-secure request accesses a secure page</dd>
* </dl>
@@ -2915,7 +2888,8 @@ public final class TapestryModule
}
/**
- * Contributes "AppCatalog" as the Resource defined by {@link SymbolConstants#APPLICATION_CATALOG}.
+ * Contributes "AppCatalog" as the Resource defined by
+ * {@link SymbolConstants#APPLICATION_CATALOG}.
*
* @since 5.2.0
*/
@@ -2994,7 +2968,8 @@ public final class TapestryModule
}
/**
- * Provides the "LinkTransformer" interceptor for the {@link ComponentEventLinkEncoder} service. Other decorations
+ * Provides the "LinkTransformer" interceptor for the {@link ComponentEventLinkEncoder} service.
+ * Other decorations
* should come after LinkTransformer.
*
* @since 5.2.0
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/test/PageTester.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/test/PageTester.java?rev=1055179&r1=1055178&r2=1055179&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/test/PageTester.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/test/PageTester.java Tue Jan 4 21:02:38 2011
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007, 2008, 2009, 2010 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 2009, 2010, 2011 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.
@@ -104,7 +104,7 @@ public class PageTester
SymbolProvider provider = new SingleKeySymbolProvider(InternalConstants.TAPESTRY_APP_PACKAGE_PARAM, appPackage);
TapestryAppInitializer initializer = new TapestryAppInitializer(logger, provider, appName,
- PageTesterModule.TEST_MODE, null);
+ null);
initializer.addModules(PageTesterModule.class);
initializer.addModules(moduleClasses);
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/test/TapestryTestCase.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/test/TapestryTestCase.java?rev=1055179&r1=1055178&r2=1055179&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/test/TapestryTestCase.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/test/TapestryTestCase.java Tue Jan 4 21:02:38 2011
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007, 2008, 2009, 2010 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 2009, 2010, 2011 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.
@@ -60,7 +60,8 @@ import org.easymock.EasyMock;
import org.easymock.IAnswer;
/**
- * Base test case that adds a number of convenience factory and training methods for the public interfaces of
+ * Base test case that adds a number of convenience factory and training methods for the public
+ * interfaces of
* Tapestry.
*/
@SuppressWarnings("all")
@@ -68,8 +69,10 @@ public abstract class TapestryTestCase e
{
/**
- * Creates a new markup writer instance (not a markup writer mock). Output can be directed at the writer, which uses
- * the default (HTML) markup model. The writer's toString() value represents all the collected markup in the
+ * Creates a new markup writer instance (not a markup writer mock). Output can be directed at
+ * the writer, which uses
+ * the default (HTML) markup model. The writer's toString() value represents all the collected
+ * markup in the
* writer.
*/
protected final MarkupWriter createMarkupWriter()
@@ -77,12 +80,6 @@ public abstract class TapestryTestCase e
return new MarkupWriterImpl();
}
- /** @deprecated May be removed in Tapestry 5.3 */
- protected final void train_getAliasesForMode(AliasManager manager, String mode, Map<Class, Object> configuration)
- {
- expect(manager.getAliasesForMode(mode)).andReturn(configuration);
- }
-
protected final ApplicationStateCreator mockApplicationStateCreator()
{
return newMock(ApplicationStateCreator.class);
@@ -891,8 +888,10 @@ public abstract class TapestryTestCase e
}
/**
- * Provides access to component messages, suitable for testing. Reads the associated .properties file for the class
- * (NOT any localization of it). Only the messages directly in the .properties file is available.
+ * Provides access to component messages, suitable for testing. Reads the associated .properties
+ * file for the class
+ * (NOT any localization of it). Only the messages directly in the .properties file is
+ * available.
*
* @param componentClass
* component class whose messages are needed *
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/AppModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/AppModule.java?rev=1055179&r1=1055178&r2=1055179&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/AppModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/services/AppModule.java Tue Jan 4 21:02:38 2011
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007, 2008, 2009, 2010 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 2009, 2010, 2011 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.
@@ -36,10 +36,11 @@ import org.apache.tapestry5.ioc.MappedCo
import org.apache.tapestry5.ioc.OrderedConfiguration;
import org.apache.tapestry5.ioc.Resource;
import org.apache.tapestry5.ioc.ServiceBinder;
+import org.apache.tapestry5.ioc.annotations.Contribute;
import org.apache.tapestry5.ioc.annotations.Marker;
import org.apache.tapestry5.ioc.annotations.Value;
import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
-import org.apache.tapestry5.services.AliasContribution;
+import org.apache.tapestry5.ioc.services.ServiceOverride;
import org.apache.tapestry5.services.BaseURLSource;
import org.apache.tapestry5.services.ComponentClassTransformWorker;
import org.apache.tapestry5.services.Request;
@@ -55,7 +56,8 @@ import org.slf4j.Logger;
public class AppModule
{
/**
- * Used to disambiguate services in this module from services in other modules that share the same service
+ * Used to disambiguate services in this module from services in other modules that share the
+ * same service
* interface.
*/
@Target(
@@ -72,14 +74,15 @@ public class AppModule
binder.bind(Reloadable.class);
binder.bind(MessageAccess.class);
}
-
- public static void contributeValidatorMacro(MappedConfiguration<String,String> configuration)
+
+ public static void contributeValidatorMacro(MappedConfiguration<String, String> configuration)
{
- configuration.add("password", "required,lengthBetweenTwoAndThree");
- configuration.add("lengthBetweenTwoAndThree", "minlength=2,maxlength=3");
+ configuration.add("password", "required,lengthBetweenTwoAndThree");
+ configuration.add("lengthBetweenTwoAndThree", "minlength=2,maxlength=3");
}
- public void contributeAlias(Configuration<AliasContribution> configuration)
+ @Contribute(ServiceOverride.class)
+ public void setupCustomBaseURLSource(MappedConfiguration<Class, Object> configuration)
{
BaseURLSource source = new BaseURLSource()
{
@@ -95,7 +98,7 @@ public class AppModule
}
};
- configuration.add(AliasContribution.create(BaseURLSource.class, source));
+ configuration.add(BaseURLSource.class, source);
}
@Marker(Local.class)
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/TapestryAppInitializerTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/TapestryAppInitializerTest.java?rev=1055179&r1=1055178&r2=1055179&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/TapestryAppInitializerTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/TapestryAppInitializerTest.java Tue Jan 4 21:02:38 2011
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007, 2008 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 2011 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.
@@ -27,7 +27,7 @@ public class TapestryAppInitializerTest
public void testLoadAppModule()
{
Registry registry = new TapestryAppInitializer(null, "org.apache.tapestry5.integration.app0",
- "foo", "").createRegistry();
+ "foo").createRegistry();
Transformer<String> s1 = registry.getService("Service1", Transformer.class);
assertEquals(s1.transform("a"), "A");
@@ -38,7 +38,7 @@ public class TapestryAppInitializerTest
{
// Apparently just checking to see that it doesn't fail.
- new TapestryAppInitializer(null, "non_existing.package", "foo", "").createRegistry();
+ new TapestryAppInitializer(null, "non_existing.package", "foo").createRegistry();
}
}
Modified: tapestry/tapestry5/trunk/tapestry-hibernate/src/main/java/org/apache/tapestry5/hibernate/HibernateModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-hibernate/src/main/java/org/apache/tapestry5/hibernate/HibernateModule.java?rev=1055179&r1=1055178&r2=1055179&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-hibernate/src/main/java/org/apache/tapestry5/hibernate/HibernateModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-hibernate/src/main/java/org/apache/tapestry5/hibernate/HibernateModule.java Tue Jan 4 21:02:38 2011
@@ -1,10 +1,10 @@
-// Copyright 2007, 2008, 2009 The Apache Software Foundation
+// Copyright 2007, 2008, 2009, 2011 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
-// http://www.apache.org/licenses/LICENSE-2.0
+// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@@ -26,10 +26,11 @@ import org.apache.tapestry5.ioc.Configur
import org.apache.tapestry5.ioc.LoggerSource;
import org.apache.tapestry5.ioc.MappedConfiguration;
import org.apache.tapestry5.ioc.OrderedConfiguration;
+import org.apache.tapestry5.ioc.annotations.Contribute;
import org.apache.tapestry5.ioc.annotations.Symbol;
import org.apache.tapestry5.ioc.services.PropertyAccess;
+import org.apache.tapestry5.ioc.services.ServiceOverride;
import org.apache.tapestry5.ioc.services.TypeCoercer;
-import org.apache.tapestry5.services.AliasContribution;
import org.apache.tapestry5.services.ApplicationStateContribution;
import org.apache.tapestry5.services.ApplicationStatePersistenceStrategy;
import org.apache.tapestry5.services.ComponentClassTransformWorker;
@@ -43,7 +44,6 @@ import org.hibernate.mapping.PersistentC
* Supplements the services defined by {@link org.apache.tapestry5.hibernate.HibernateCoreModule} with additional
* services and configuration specific to Tapestry web application.
*/
-@SuppressWarnings({"JavaDoc"})
public class HibernateModule
{
public static void contributeFactoryDefaults(MappedConfiguration<String, String> configuration)
@@ -58,19 +58,19 @@ public class HibernateModule
*/
public static void contributeHibernateEntityPackageManager(Configuration<String> configuration,
- @Symbol(InternalConstants.TAPESTRY_APP_PACKAGE_PARAM)
- String appRootPackage)
+ @Symbol(InternalConstants.TAPESTRY_APP_PACKAGE_PARAM)
+ String appRootPackage)
{
configuration.add(appRootPackage + ".entities");
}
-
- public static void contributeAlias(Configuration<AliasContribution> configuration, @HibernateCore Session session)
+ @Contribute(ServiceOverride.class)
+ public static void provideInjectableSessionObject(MappedConfiguration<Class, Object> configuration, @HibernateCore
+ Session session)
{
- configuration.add(AliasContribution.create(Session.class, session));
+ configuration.add(Session.class, session);
}
-
/**
* Contributes {@link ValueEncoderFactory}s for all registered Hibernate entity classes. Encoding and decoding are
* based on the id property value of the entity using type coercion. Hence, if the id can be coerced to a String and
@@ -78,15 +78,12 @@ public class HibernateModule
*/
@SuppressWarnings("unchecked")
public static void contributeValueEncoderSource(MappedConfiguration<Class, ValueEncoderFactory> configuration,
- @Symbol(HibernateSymbols.PROVIDE_ENTITY_VALUE_ENCODERS)
- boolean provideEncoders,
- final HibernateSessionSource sessionSource,
- final Session session,
- final TypeCoercer typeCoercer,
- final PropertyAccess propertyAccess,
- final LoggerSource loggerSource)
+ @Symbol(HibernateSymbols.PROVIDE_ENTITY_VALUE_ENCODERS)
+ boolean provideEncoders, final HibernateSessionSource sessionSource, final Session session,
+ final TypeCoercer typeCoercer, final PropertyAccess propertyAccess, final LoggerSource loggerSource)
{
- if (!provideEncoders) return;
+ if (!provideEncoders)
+ return;
org.hibernate.cfg.Configuration config = sessionSource.getConfiguration();
Iterator<PersistentClass> mappings = config.getClassMappings();
@@ -94,59 +91,69 @@ public class HibernateModule
{
final PersistentClass persistentClass = mappings.next();
final Class entityClass = persistentClass.getMappedClass();
-
- if(entityClass != null)
+
+ if (entityClass != null)
{
ValueEncoderFactory factory = new ValueEncoderFactory()
{
public ValueEncoder create(Class type)
{
return new HibernateEntityValueEncoder(entityClass, persistentClass, session, propertyAccess,
- typeCoercer, loggerSource.getLogger(entityClass));
+ typeCoercer, loggerSource.getLogger(entityClass));
}
};
-
+
configuration.add(entityClass, factory);
-
+
}
}
}
/**
- * Contributes the following: <dl> <dt>entity</dt> <dd>Stores the id of the entity and reloads from the {@link
- * Session}</dd> </dl>
+ * Contributes the following:
+ * <dl>
+ * <dt>entity</dt>
+ * <dd>Stores the id of the entity and reloads from the {@link Session}</dd>
+ * </dl>
*/
public static void contributePersistentFieldManager(
MappedConfiguration<String, PersistentFieldStrategy> configuration)
{
configuration.addInstance(HibernatePersistenceConstants.ENTITY, EntityPersistentFieldStrategy.class);
}
-
+
/**
- * Contributes the following strategy: <dl> <dt>entity</dt> <dd>Stores the id of the entity and reloads from the {@link
- * Session}</dd> </dl>
+ * Contributes the following strategy:
+ * <dl>
+ * <dt>entity</dt>
+ * <dd>Stores the id of the entity and reloads from the {@link Session}</dd>
+ * </dl>
*/
public void contributeApplicationStatePersistenceStrategySource(
MappedConfiguration<String, ApplicationStatePersistenceStrategy> configuration)
{
- configuration.addInstance(HibernatePersistenceConstants.ENTITY, EntityApplicationStatePersistenceStrategy.class);
+ configuration
+ .addInstance(HibernatePersistenceConstants.ENTITY, EntityApplicationStatePersistenceStrategy.class);
}
-
+
/**
* Contributes {@link ApplicationStateContribution}s for all registered Hibernate entity classes.
*
- * @param configuration Configuration to contribute
- * @param entitySessionStatePersistenceStrategyEnabled indicates if contribution should take place
- * @param sessionSource creates Hibernate session
- */
- public static void contributeApplicationStateManager(MappedConfiguration<Class, ApplicationStateContribution> configuration,
- @Symbol(HibernateSymbols.ENTITY_SESSION_STATE_PERSISTENCE_STRATEGY_ENABLED)
- boolean entitySessionStatePersistenceStrategyEnabled,
- HibernateSessionSource sessionSource)
- {
-
- if(!entitySessionStatePersistenceStrategyEnabled)
- return;
+ * @param configuration
+ * Configuration to contribute
+ * @param entitySessionStatePersistenceStrategyEnabled
+ * indicates if contribution should take place
+ * @param sessionSource
+ * creates Hibernate session
+ */
+ public static void contributeApplicationStateManager(
+ MappedConfiguration<Class, ApplicationStateContribution> configuration,
+ @Symbol(HibernateSymbols.ENTITY_SESSION_STATE_PERSISTENCE_STRATEGY_ENABLED)
+ boolean entitySessionStatePersistenceStrategyEnabled, HibernateSessionSource sessionSource)
+ {
+
+ if (!entitySessionStatePersistenceStrategyEnabled)
+ return;
org.hibernate.cfg.Configuration config = sessionSource.getConfiguration();
Iterator<PersistentClass> mappings = config.getClassMappings();
@@ -155,14 +162,14 @@ public class HibernateModule
final PersistentClass persistentClass = mappings.next();
final Class entityClass = persistentClass.getMappedClass();
-
+
configuration.add(entityClass, new ApplicationStateContribution(HibernatePersistenceConstants.ENTITY));
}
}
/**
- * Adds the CommitAfter annotation work, to process the {@link org.apache.tapestry5.hibernate.annotations.CommitAfter}
- * annotation.
+ * Adds the CommitAfter annotation work, to process the
+ * {@link org.apache.tapestry5.hibernate.annotations.CommitAfter} annotation.
*/
public static void contributeComponentClassTransformWorker(
OrderedConfiguration<ComponentClassTransformWorker> configuration)
@@ -171,7 +178,7 @@ public class HibernateModule
configuration.addInstance("CommitAfter", CommitAfterWorker.class, "after:Log");
}
-
+
/**
* Contribution to the {@link org.apache.tapestry5.services.ComponentClassResolver} service configuration.
*/