You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2010/06/06 05:14:28 UTC
svn commit: r951810 - in /tapestry/tapestry5/trunk:
tapestry-core/src/main/java/org/apache/tapestry5/services/
tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/
Author: hlship
Date: Sun Jun 6 03:14:26 2010
New Revision: 951810
URL: http://svn.apache.org/viewvc?rev=951810&view=rev
Log:
Mark Alias and AliasContribution as deprecated in favor of ServiceOverride
Modified:
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-ioc/src/main/java/org/apache/tapestry5/ioc/services/ServiceOverride.java
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/Alias.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/Alias.java?rev=951810&r1=951809&r2=951810&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/Alias.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/Alias.java Sun Jun 6 03:14:26 2010
@@ -1,10 +1,10 @@
-// Copyright 2006, 2007, 2008 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 2010 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
-// http://www.apache.org/licenses/LICENSE-2.0
+// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@@ -15,6 +15,8 @@
package org.apache.tapestry5.services;
import org.apache.tapestry5.ioc.ObjectProvider;
+import org.apache.tapestry5.ioc.annotations.UsesConfiguration;
+import org.apache.tapestry5.ioc.services.ServiceOverride;
/**
* The Alias service provides an ObjectProvider that fits into the MasterObjectProvider command chain and disambiguates
@@ -22,15 +24,18 @@ import org.apache.tapestry5.ioc.ObjectPr
* service identify the desired service to inject for a particular service interface; this is only necessary when there
* is more than one service implementing the same interface.
* <p/>
- * The {@linkplain AliasManager AliasOverrides} service also takes an unordered configuration of {@link
- * org.apache.tapestry5.services.AliasContribution}; such contributions override the "factory" contributions to the Alias
- * service itself. This is often used to replace built-in service implementations with ones that are specific to a
- * particular application.
+ * The {@linkplain AliasManager} service also takes an unordered configuration of
+ * {@link org.apache.tapestry5.services.AliasContribution}; such contributions override the "factory" contributions to
+ * the Alias service itself. This is often used to replace built-in service implementations with ones that are specific
+ * to a particular application.
+ *
+ * @deprecated Use {@link ServiceOverride} instead
*/
+@UsesConfiguration(AliasContribution.class)
public interface Alias
{
/**
- * Returns an object provideer that checks the desired type against the service's contributions.
+ * Returns an object provider that checks the desired type against the service's contributions.
*/
ObjectProvider getObjectProvider();
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/AliasContribution.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/AliasContribution.java?rev=951810&r1=951809&r2=951810&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/AliasContribution.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/AliasContribution.java Sun Jun 6 03:14:26 2010
@@ -4,7 +4,7 @@
// 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,
@@ -16,11 +16,14 @@ package org.apache.tapestry5.services;
import static org.apache.tapestry5.ioc.internal.util.Defense.notNull;
import org.apache.tapestry5.ioc.internal.util.InternalUtils;
+import org.apache.tapestry5.ioc.services.ServiceOverride;
import java.util.Formatter;
/**
* A contribution into the {@link Alias} or AliasOverride service configuration.
+ *
+ * @deprecated Use {@link ServiceOverride} instead
*/
public final class AliasContribution<T>
{
@@ -92,7 +95,8 @@ public final class AliasContribution<T>
formatter.format("<AliasContribution: %s", contributionType.getName());
- if (InternalUtils.isNonBlank(mode)) formatter.format(" mode:%s", mode);
+ if (InternalUtils.isNonBlank(mode))
+ formatter.format(" mode:%s", mode);
formatter.format(" %s>", object);
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/AliasManager.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/AliasManager.java?rev=951810&r1=951809&r2=951810&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/AliasManager.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/AliasManager.java Sun Jun 6 03:14:26 2010
@@ -1,10 +1,10 @@
-// Copyright 2006, 2007, 2008 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 2010 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
-// http://www.apache.org/licenses/LICENSE-2.0
+// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@@ -15,13 +15,17 @@
package org.apache.tapestry5.services;
import org.apache.tapestry5.ioc.annotations.UsesConfiguration;
+import org.apache.tapestry5.ioc.services.ServiceOverride;
import java.util.Map;
/**
- * A thin wrapper around a set of {@link org.apache.tapestry5.services.AliasContribution}s. An {@link
- * org.apache.tapestry5.ioc.ObjectProvider} is contributed to the {@link org.apache.tapestry5.ioc.services.MasterObjectProvider}
- * service, to allow contributed objects to replace other objects (typically, built in services).
+ * A thin wrapper around a set of {@link org.apache.tapestry5.services.AliasContribution}s. An
+ * {@link org.apache.tapestry5.ioc.ObjectProvider} is contributed to the
+ * {@link org.apache.tapestry5.ioc.services.MasterObjectProvider} service, to allow contributed objects to replace other
+ * objects (typically, built in services).
+ *
+ * @deprecated Use {@link ServiceOverride} instead
*/
@UsesConfiguration(AliasContribution.class)
public interface AliasManager
@@ -31,7 +35,7 @@ public interface AliasManager
* contribution type and a non-null object that implements the type 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 map from contribution type to contribution object
*/
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/ServiceOverride.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/ServiceOverride.java?rev=951810&r1=951809&r2=951810&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/ServiceOverride.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/ServiceOverride.java Sun Jun 6 03:14:26 2010
@@ -1,10 +1,10 @@
-// Copyright 2009 The Apache Software Foundation
+// Copyright 2009, 2010 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
-// http://www.apache.org/licenses/LICENSE-2.0
+// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@@ -18,18 +18,21 @@ import org.apache.tapestry5.ioc.ObjectPr
import org.apache.tapestry5.ioc.annotations.UsesMappedConfiguration;
/**
- * Used to override built in services. Simply contribute a mapping from a type to an instance of that type. Anywhere
+ * Used to override built in services. Simply contribute a mapping from a type to an instance of that type. Anywhere
* that exact type is injected, without specifying markers or other annotations, the contributed instance will be
* injected, even if there is already a service that implements the interface.
- *
+ * <p>
+ * In fact, this is <em>not</em> limited to overriding services; any object that can be injected based solely on type
+ * can be contributed.
+ *
* @since 5.1.0.0
*/
@UsesMappedConfiguration(key = Class.class, value = Object.class)
public interface ServiceOverride
{
/**
- * Returns a provider based on the configuration; this is wired into the {@link
- * org.apache.tapestry5.ioc.services.MasterObjectProvider}'s configuration.
+ * Returns a provider based on the configuration; this is wired into the
+ * {@link org.apache.tapestry5.ioc.services.MasterObjectProvider}'s configuration.
*/
ObjectProvider getServiceOverrideProvider();
}