Author: hlship
Date: Sat Mar 10 18:17:02 2007
New Revision: 516843
URL: http://svn.apache.org/viewvc?view=rev&rev=516843
Log:
TAPESTRY-1339: Adjust for changes to tapestry-ioc
Modified:
tapestry/tapestry5/tapestry-spring/trunk/src/main/java/org/apache/tapestry/spring/SpringModule.java
Modified:
tapestry/tapestry5/tapestry-spring/trunk/src/main/java/org/apache/tapestry/spring/SpringModule.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-spring/trunk/src/main/java/org/apache/tapestry/spring/SpringModule.java?view=diff&rev=516843&r1=516842&r2=516843
==============================================================================
---
tapestry/tapestry5/tapestry-spring/trunk/src/main/java/org/apache/tapestry/spring/SpringModule.java
(original)
+++
tapestry/tapestry5/tapestry-spring/trunk/src/main/java/org/apache/tapestry/spring/SpringModule.java
Sat Mar 10 18:17:02 2007
@@ -17,64 +17,61 @@
import org.apache.commons.logging.Log;
import org.apache.tapestry.ioc.MappedConfiguration;
import org.apache.tapestry.ioc.ObjectProvider;
-import org.apache.tapestry.ioc.annotations.Contribute;
-import org.apache.tapestry.ioc.annotations.Id;
import org.apache.tapestry.ioc.annotations.Inject;
import org.apache.tapestry.ioc.annotations.InjectService;
import org.apache.tapestry.services.Context;
import org.springframework.web.context.WebApplicationContext;
[EMAIL PROTECTED]("tapestry.spring")
public class SpringModule
{
- /**
- * Provider that interprets expressions as the names of beans within the
Spring
- * [EMAIL PROTECTED] WebApplicationContext}.
- */
- public static ObjectProvider buildSpringObjectProvider(Log log,
- @Inject("service:WebApplicationContext")
- WebApplicationContext context)
- {
- return new SpringObjectProvider(log, context);
- }
-
- /**
- * Obtains and returns the Spring WebApplicationContext, which is stored in
the Servlet context
- * using a well-known name. The WebApplicationContext must be configured in
the <a
- *
href="http://static.springframework.org/spring/docs/1.2.x/reference/beans.html#context-create">standard
- * way</a> (which involves adding a listener to the web.xml deployment
descriptor).
- */
- public static WebApplicationContext
buildWebApplicationContext(@Inject("infrastructure:context")
- Context context)
- {
- WebApplicationContext springContext = null;
-
- try
+ /**
+ * Provider that interprets expressions as the names of beans within the
Spring
+ * [EMAIL PROTECTED] WebApplicationContext}.
+ */
+ public static ObjectProvider buildSpringObjectProvider(Log log,
+ @Inject("service:WebApplicationContext")
+ WebApplicationContext context)
{
- springContext = (WebApplicationContext) context
-
.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
+ return new SpringObjectProvider(log, context);
}
- catch (Exception ex)
+
+ /**
+ * Obtains and returns the Spring WebApplicationContext, which is stored
in the Servlet context
+ * using a well-known name. The WebApplicationContext must be configured
in the <a
+ *
href="http://static.springframework.org/spring/docs/1.2.x/reference/beans.html#context-create">standard
+ * way</a> (which involves adding a listener to the web.xml deployment
descriptor).
+ */
+ public static WebApplicationContext buildWebApplicationContext(
+ @Inject("infrastructure:context")
+ Context context)
{
- throw new RuntimeException(SpringMessages.failureObtainingContext(ex),
ex);
- }
+ WebApplicationContext springContext = null;
+
+ try
+ {
+ springContext = (WebApplicationContext) context
+
.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
+ }
+ catch (Exception ex)
+ {
+ throw new
RuntimeException(SpringMessages.failureObtainingContext(ex), ex);
+ }
- if (springContext == null) throw new
RuntimeException(SpringMessages.missingContext());
+ if (springContext == null) throw new
RuntimeException(SpringMessages.missingContext());
- return springContext;
- }
+ return springContext;
+ }
+
+ /**
+ * Contributes a "spring:" provider, that obtains beans from the
+ * [EMAIL PROTECTED] #buildSpringObjectProvider(Log, Context)
SpringObjectProvider service}.
+ */
+ public static void
contributeMasterObjectProvider(@InjectService("SpringObjectProvider")
+ ObjectProvider springObjectProvider,
- /**
- * Contributes a "spring:" provider, that obtains beans from the
- * [EMAIL PROTECTED] #buildSpringObjectProvider(Log, Context)
SpringObjectProvider service}.
- */
- @Contribute("tapestry.ioc.MasterObjectProvider")
- public static void
contributeMasterObjectProvider(@InjectService("SpringObjectProvider")
- ObjectProvider springObjectProvider,
-
- MappedConfiguration<String, ObjectProvider> configuration)
- {
- configuration.add("spring", springObjectProvider);
- }
+ MappedConfiguration<String, ObjectProvider> configuration)
+ {
+ configuration.add("spring", springObjectProvider);
+ }
}