Author: craigmcc
Date: Sat Apr 2 17:08:34 2005
New Revision: 159858
URL: http://svn.apache.org/viewcvs?view=rev&rev=159858
Log:
Use Spring's JSF integration to look up the business logic and DAO for the
logon dialog (instead of JSF managed beans). Note that the application logic,
which uses a value binding expression to perform the lookup, did *not* have
to change because Spring provides a JSF VariableResolver that transparently
invokes the bean factory in the appropriate WebApplicationContext if no
standard JSF managed bean exists for a given name.
Added:
struts/shale/trunk/use-cases/src/web/WEB-INF/applicationContext.xml
struts/shale/trunk/use-cases/src/web/WEB-INF/daoContext.xml
Modified:
struts/shale/trunk/use-cases/build.xml
struts/shale/trunk/use-cases/src/web/WEB-INF/faces-config.xml
struts/shale/trunk/use-cases/src/web/WEB-INF/web.xml
Modified: struts/shale/trunk/use-cases/build.xml
URL:
http://svn.apache.org/viewcvs/struts/shale/trunk/use-cases/build.xml?view=diff&r1=159857&r2=159858
==============================================================================
--- struts/shale/trunk/use-cases/build.xml (original)
+++ struts/shale/trunk/use-cases/build.xml Sat Apr 2 17:08:34 2005
@@ -40,6 +40,7 @@
<property name="jstl.home"
value="/usr/local/jakarta-taglibs-standard-1.1.2"/>
<property name="junit.home" value="/usr/local/junit-3.8.1"/>
<property name="server.home" value="/usr/local/jakarta-tomcat-5.0.28"/>
+ <property name="spring.home" value="/usr/local/spring-framework-1.1.5"/>
<!-- Dependency library defaults -->
@@ -60,7 +61,11 @@
<property name="junit.jar" value="${junit.home}/junit.jar"/>
<property name="servlet-api.jar"
value="${server.home}/common/lib/servlet-api.jar"/>
<property name="shale.jar"
value="${basedir}/../core-library/target/lib/shale.jar"/>
+ <property name="shale-spring.jar"
value="${basedir}/../core-library/target/lib/shale-spring.jar"/>
<property name="shale-test.jar"
value="${basedir}/../test-framework/target/lib/shale-test.jar"/>
+ <property name="spring-context.jar"
value="${spring.home}/dist/spring-context.jar"/>
+ <property name="spring-core.jar"
value="${spring.home}/dist/spring-core.jar"/>
+ <property name="spring-web.jar"
value="${spring.home}/dist/spring-web.jar"/>
<property name="standard.jar" value="${jstl.home}/lib/standard.jar"/>
@@ -208,6 +213,14 @@
file="${commons-logging.jar}"/>
<copy todir="${build.home}/${context.path}/WEB-INF/lib"
file="${shale.jar}"/>
+ <copy todir="${build.home}/${context.path}/WEB-INF/lib"
+ file="${shale-spring.jar}"/>
+ <copy todir="${build.home}/${context.path}/WEB-INF/lib"
+ file="${spring-context.jar}"/>
+ <copy todir="${build.home}/${context.path}/WEB-INF/lib"
+ file="${spring-core.jar}"/>
+ <copy todir="${build.home}/${context.path}/WEB-INF/lib"
+ file="${spring-web.jar}"/>
</target>
Added: struts/shale/trunk/use-cases/src/web/WEB-INF/applicationContext.xml
URL:
http://svn.apache.org/viewcvs/struts/shale/trunk/use-cases/src/web/WEB-INF/applicationContext.xml?view=auto&rev=159858
==============================================================================
--- struts/shale/trunk/use-cases/src/web/WEB-INF/applicationContext.xml (added)
+++ struts/shale/trunk/use-cases/src/web/WEB-INF/applicationContext.xml Sat Apr
2 17:08:34 2005
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2004-2005 The Apache Software Foundation.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
+ "http://www.springframework.org/dtd/spring-beans.dtd">
+
+<!-- Application Bean Configuration for Use Cases Example -->
+
+<beans>
+
+
+ <!-- Business logic used to manipulate registered user profile
+ information, and authenticate logons -->
+ <bean name="logon$logic"
+ class="org.apache.shale.usecases.logic.LogonLogic"
+ singleton="false">
+ <property name="dao">
+ <ref bean="logon$users"/>
+ </property>
+ </bean>
+
+
+</beans>
Added: struts/shale/trunk/use-cases/src/web/WEB-INF/daoContext.xml
URL:
http://svn.apache.org/viewcvs/struts/shale/trunk/use-cases/src/web/WEB-INF/daoContext.xml?view=auto&rev=159858
==============================================================================
--- struts/shale/trunk/use-cases/src/web/WEB-INF/daoContext.xml (added)
+++ struts/shale/trunk/use-cases/src/web/WEB-INF/daoContext.xml Sat Apr 2
17:08:34 2005
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2004-2005 The Apache Software Foundation.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
+ "http://www.springframework.org/dtd/spring-beans.dtd">
+
+<!-- DAO Bean Configuration for Use Cases Example -->
+
+<beans>
+
+ <!-- Data Access Object (DAO) used to manipuate registered
+ user profile information -->
+ <bean name="logon$users"
+ class="org.apache.shale.usecases.model.minimal.MinimalUsersDAO"
+ singleton="true">
+ </bean>
+
+
+</beans>
Modified: struts/shale/trunk/use-cases/src/web/WEB-INF/faces-config.xml
URL:
http://svn.apache.org/viewcvs/struts/shale/trunk/use-cases/src/web/WEB-INF/faces-config.xml?view=diff&r1=159857&r2=159858
==============================================================================
--- struts/shale/trunk/use-cases/src/web/WEB-INF/faces-config.xml (original)
+++ struts/shale/trunk/use-cases/src/web/WEB-INF/faces-config.xml Sat Apr 2
17:08:34 2005
@@ -340,6 +340,7 @@
</managed-bean>
+<!-- Comment out to use Spring BeanFactory for instantiation
<managed-bean>
<description>
Business logic used to manipulate registered user profile
@@ -356,8 +357,10 @@
<value>#{logon$users}</value>
</managed-property>
</managed-bean>
+-->
+<!-- Comment out to use Spring BeanFactory for instantiation
<managed-bean>
<description>
Data Access Object (DAO) used to manipulate registered user profile
@@ -369,6 +372,11 @@
</managed-bean-class>
<managed-bean-scope>application</managed-bean-scope>
</managed-bean>
+-->
</faces-config>
+
+
+
+
Modified: struts/shale/trunk/use-cases/src/web/WEB-INF/web.xml
URL:
http://svn.apache.org/viewcvs/struts/shale/trunk/use-cases/src/web/WEB-INF/web.xml?view=diff&r1=159857&r2=159858
==============================================================================
--- struts/shale/trunk/use-cases/src/web/WEB-INF/web.xml (original)
+++ struts/shale/trunk/use-cases/src/web/WEB-INF/web.xml Sat Apr 2 17:08:34
2005
@@ -38,6 +38,12 @@
<param-value>/WEB-INF/chain-config.xml</param-value>
</context-param>
+ <!-- Spring ApplicationContext Configuration -->
+ <context-param>
+ <param-name>contextConfigLocation</param-name>
+ <param-value>/WEB-INF/daoContext.xml
/WEB-INF/applicationContext.xml</param-value>
+ </context-param>
+
<!-- Shale Application Controller Filter -->
<filter>
<filter-name>shale</filter-name>
@@ -64,6 +70,13 @@
<listener>
<listener-class>
org.apache.commons.chain.web.ChainListener
+ </listener-class>
+ </listener>
+
+ <!-- Spring ApplicationContext Configuration Listener -->
+ <listener>
+ <listener-class>
+ org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]