Ok ! This document is definitely useful. But if I try to summarize
what I have to do to integrate my Spring/Hibernate stuff into Cocoon :
1 - add this section to web.xml
<filter>
<filter-name>OpenSessionInViewFilter</filter-name>
<filter-class>
org.springframework.orm.hibernate.support.OpenSessionInViewFilter
</filter-class>
<init-param>
<param-name>singleSession</param-name>
<param-value>false</param-value>
</init-param>
</filter>
2 - add something like this to my applicationContext.xml
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName">
<value>org.hsqldb.jdbcDriver</value>
</property>
<property name="url">
<value>jdbc:hsqldb:hsql://localhost:9003</value>
</property>
<property name="username">
<value>sa</value>
</property>
<property name="password">
<value></value>
</property>
</bean>
(Knowing that my hsqldb server is configured this way in cocoon.xconf :
<hsqldb-server class="org.apache.cocoon.components.hsqldb.ServerImpl"
logger="core.hsqldb-server" pool-max="1">
<parameter name="port" value="9003"/>
<parameter name="silent" value="false"/>
<parameter name="trace" value="true"/>
<parameter name="thread-pool-name" value="daemon"/>
<parameter name="name" value="schamandb"/>
<parameter name="path" value="context://WEB-INF/db"/>
</hsqldb-server>)
3 - Setting up a Hibernate session factory, DAO's and services (for me
it's done by androMDA)
4 - Add this section to web.xml
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
(Is it a problem if my applicationContext.xml doesn't include my
datasource bean definition, it's generated in another file called
applicationContext-datasource.xml and I have some beanRefFactory.xml
with the following content :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans
PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="beanRefFactory"
class="org.springframework.context.support.ClassPathXmlApplicationContext">
<constructor-arg>
<list>
<value>applicationContext.xml</value>
<value>applicationContext-dataSource.xml</value>
</list>
</constructor-arg>
</bean>
</beans>)
5 - Using the following flowscript code to access my beans :
var appCtx = cocoon.context.getAttribute(
WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
var bean = appCtx.getBean("beanName");
Does someone confirm ?
BTW, if someone has already worked with AndroMDA and Cocoon, there is
a ServiceLocator singleton which is generated ? Can I use it in
Flowscript ? Isn't there any lazy-loading problem ?
I know that this is some difficult question but I would really
appreciate an answer because it's the last step I have to achieve in
order to make my application work.
Thank you very much in advance.
Regards.
--
Sebastien ARBOGAST
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]