You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2007/05/23 22:29:21 UTC

svn commit: r541055 - in /myfaces/current/orchestra/core/src/site: site.xml xdoc/alternative-configuration.xml

Author: werpu
Date: Wed May 23 13:29:20 2007
New Revision: 541055

URL: http://svn.apache.org/viewvc?view=rev&rev=541055
Log:
added a working and well tested tomcat configuration

Added:
    myfaces/current/orchestra/core/src/site/xdoc/alternative-configuration.xml
Modified:
    myfaces/current/orchestra/core/src/site/site.xml

Modified: myfaces/current/orchestra/core/src/site/site.xml
URL: http://svn.apache.org/viewvc/myfaces/current/orchestra/core/src/site/site.xml?view=diff&rev=541055&r1=541054&r2=541055
==============================================================================
--- myfaces/current/orchestra/core/src/site/site.xml (original)
+++ myfaces/current/orchestra/core/src/site/site.xml Wed May 23 13:29:20 2007
@@ -37,6 +37,7 @@
 		<menu name="MyFaces Orchestra">
 			<item name="About" href="about.html"/>
 			<item name="Installation" href="installation.html"/>
+			<item name="Alternative Configuration" href="alternative-configuration.html"/>
 			<item name="Management" href="conversationManagement.html"/>
 			<item name="Best Practice" href="bestPractice.html"/>
 			<item name="TODO" href="todo.html"/>

Added: myfaces/current/orchestra/core/src/site/xdoc/alternative-configuration.xml
URL: http://svn.apache.org/viewvc/myfaces/current/orchestra/core/src/site/xdoc/alternative-configuration.xml?view=auto&rev=541055
==============================================================================
--- myfaces/current/orchestra/core/src/site/xdoc/alternative-configuration.xml (added)
+++ myfaces/current/orchestra/core/src/site/xdoc/alternative-configuration.xml Wed May 23 13:29:20 2007
@@ -0,0 +1,159 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE document PUBLIC "-//Apache Software Foundation//DTD XDOC 1.0//EN"
+	"http://www.apache.org/dtd/xdoc.dtd">
+<document>
+	<properties>
+		<title>Installation</title>
+	</properties>
+
+	<body>
+		<section name="Installation">
+		The following configuration provides a blueprint for
+		a single Tomcat installation using Spring 2.0, jpa ri
+		and runtime weaving.
+		
+		<subsection name="Prerequisites">
+		
+		<ul>
+			<li>Prerequisites - Knowledge: Basic Spring 2.0 configuration knowledge, knowledge about 
+			the jpa ri, to the level that knowing what runtime weaving is can be assumed.
+			</li>
+			<li>Prerequisites - JDK Versions: JDK 5+ (on non Sun JDKs a working runtime weaving on 5
+			or a 6+ non Sun JDK)</li>
+			<li>Tomcat: 5.5+</li>	 
+			<li>Spring 2.x+</li>
+		</ul>
+		</subsection>
+		<subsection name="Spring configuration">
+		The following configuration uses runtime weaving, and
+		a connection pool. It should work on most Tomcat configurations.
+		
+		
+		<pre>
+&lt;?xml version="1.0" encoding="UTF-8"?&gt;
+&lt;beans xmlns="http://www.springframework.org/schema/beans"
+   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xmlns:tx="http://www.springframework.org/schema/tx"
+   xmlns:aop="http://www.springframework.org/schema/aop"
+   xmlns:sa="https://spring-annotation.dev.java.net/context"
+
+  	    xsi:schemaLocation="
+	http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+	http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
+	http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd"
+	&gt;
+
+	&lt;tx:annotation-driven transaction-manager="transactionManager" /&gt;
+    &lt;bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/&gt;
+	
+		&lt;bean class="org.springframework.beans.factory.config.CustomScopeConfigurer"&gt;
+		&lt;property name="scopes"&gt;
+			&lt;map&gt;
+				&lt;entry key="conversation"&gt;
+					&lt;bean class="org.apache.myfaces.orchestra.conversation.spring.SpringConversationScope"&gt;
+						&lt;property name="advices"&gt;
+							&lt;list&gt;
+								&lt;ref bean="persistentContextConversationInterceptor" /&gt;
+							&lt;/list&gt;
+						&lt;/property&gt;
+					&lt;/bean&gt;
+				&lt;/entry&gt;
+			&lt;/map&gt;
+		&lt;/property&gt;
+	&lt;/bean&gt;
+
+	&lt;bean id="thedataSource"
+		class="org.apache.commons.dbcp.BasicDataSource"&gt;
+		
+		&lt;property name="driverClassName" value="org.h2.Driver" /&gt;
+		&lt;property name="url"
+			value="jdbc:h2:/DATA/dummydatabase;MODE=MYSQL" /&gt;
+		
+		&lt;property name="username" value="theusername" /&gt;
+		&lt;property name="password" value="thepassword" /&gt;
+		
+		&lt;property name="initialSize"&gt;
+    		&lt;value&gt;2&lt;/value&gt;
+  		&lt;/property&gt;
+  		&lt;property name="maxActive"&gt;
+    		&lt;value&gt;100&lt;/value&gt;
+  		&lt;/property&gt;
+  		&lt;property name="maxIdle"&gt;
+    		&lt;value&gt;2&lt;/value&gt;
+  		&lt;/property&gt;
+	&lt;/bean&gt;
+
+	&lt;bean id="entityManagerFactory"
+		class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"&gt;
+
+		&lt;property name="dataSource" ref="thedataSource" /&gt;
+		&lt;property name="jpaDialect"&gt;
+     		&lt;bean class="org.springframework.orm.jpa.vendor.TopLinkJpaDialect" /&gt;
+   		&lt;/property&gt; 	
+		&lt;property name="jpaVendorAdapter"&gt;
+			&lt;bean
+				class="org.springframework.orm.jpa.vendor.TopLinkJpaVendorAdapter"&gt;
+				&lt;property name="showSql" value="false" /&gt;
+				&lt;property name="generateDdl" value="true" /&gt;
+				&lt;property name="databasePlatform" value="oracle.toplink.essentials.platform.database.MySQL4Platform" /&gt;
+			&lt;/bean&gt;
+		&lt;/property&gt;
+		
+		&lt;property name="jpaProperties"&gt;
+			  
+			&lt;props&gt;
+				&lt;prop key="toplink.logging.level"&gt;INFO&lt;/prop&gt;
+				&lt;prop key="toplink.target-database"&gt;oracle.toplink.essentials.platform.database.MySQL4Platform&lt;/prop&gt;
+				&lt;prop key="toplink.ddl-generation"&gt;create-tables&lt;/prop&gt;
+				&lt;prop key="toplink.cache.type.default"&gt;HardWeak&lt;/prop&gt;
+				&lt;prop key="toplink.cache.size.default"&gt;5000&lt;/prop&gt;
+			&lt;/props&gt;
+		&lt;/property&gt;		
+		&lt;property name="loadTimeWeaver"&gt;
+			&lt;bean
+				class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver" /&gt;
+		&lt;/property&gt;
+	&lt;/bean&gt;
+
+	&lt;bean id="transactionManager"
+		class="org.springframework.orm.jpa.JpaTransactionManager"&gt;
+		&lt;property name="entityManagerFactory"
+			ref="entityManagerFactory" /&gt;
+		
+    &lt;/bean&gt;
+    
+	&lt;bean id="jpaPersistentContextFactory" class="org.apache.myfaces.orchestra.conversation.persistenceContexts.JpaPersistenceContextFactory"&gt;
+		&lt;property name="entityManagerFactory" ref="entityManagerFactory" /&gt;
+	&lt;/bean&gt;
+ 	&lt;bean id="persistentContextConversationInterceptor" class="org.apache.myfaces.orchestra.conversation.spring.PersistenceContextConversationInterceptor"&gt;
+		&lt;property name="persistenceContextFactory" ref="jpaPersistentContextFactory" /&gt;
+	&lt;/bean&gt;
+
+&lt;/beans&gt;		
+		</pre>
+		
+		This configuration enables load time weaving of the orm classes and thus allows
+		lazy instantiation of classes. The main issue with this configuration is, that
+		Tomcat still needs a javaagent passed down as parameter. If this is not done
+		the loadtime weaving ultimately will fail.
+		the required javaagent is:
+		<pre>
+-javaagent:&lt;path to the spring weavers&gt;/weavers/spring-agent.jar
+		</pre>
+		There are weaverless configurations as well, in spring 2.0.2 it was not yet possible to enable
+		them for jpa and Tomcat. This situation might change soon, please refer to the Spring documentation
+		for additional information on how to enable the loadtime weaving of jpa classes.
+		
+		</subsection>
+		<subsection name="Key differences to the original configuration">
+		Following key differences can be found:
+		<ul>
+			<li> Load time weaving enabled via: &lt;property name="loadTimeWeaver"&gt; </li>
+			<li> A connection pool was used instead of a plain jdbc connection </li>
+			<li> Tomcat has to be started with an appropriate javaagent statement </li>	
+		</ul>
+		</subsection>
+		
+		</section>
+	</body>
+</document>		
\ No newline at end of file