Moving to MyFaces Orchestra…

Yes, I was using Apache Shale in my little FacesGoodies demo, but now I move Orchestra in; and Shale out. Why ? Especially Orchestra has more features to deal with ORM frameworks, via Spring.

My FacesGoodies already uses JPA with OpenJPA and HSQLDB, so, not much to add, well more XML isn’t what I like, but it’s ok for now…

What to do? I added a orchestra.spring.xml file, containing these lines of code:

<!-- 1. initialization of all orchestra modules (required for core15 module) -->
<import resource="classpath*:/META-INF/spring-orchestra-init.xml" />
<!-- 2. the conversation scopes -->
<bean class="org.springframework.beans.factory.config.CustomScopeConfigurer">
<property name="scopes">
<map>
<entry key="conversation.manual">
<bean class="org.apache.myfaces.orchestra.conversation.spring.SpringConversationScope">
<property name="timeout" value="30" />
<property name="advices">
<list>
<ref bean="persistentContextConversationInterceptor"/>
</list>
</property>
</bean>
</entry>
<entry key="conversation.flash">
<bean class="org.apache.myfaces.orchestra.conversation.spring.SpringConversationScope">
<property name="timeout" value="30" />
<property name="advices">
<list>
<ref bean="persistentContextConversationInterceptor"/>
</list>
</property>
<property name="lifetime" value="flash"/>
</bean>
</entry>
</map>
</property>
</bean>
<!-- 3. the "entity manager" manager -->
<bean id="persistentContextConversationInterceptor"
class="org.apache.myfaces.orchestra.conversation.spring.PersistenceContextConversationInterceptor">
<property name="persistenceContextFactory" ref="persistentContextFactory" />
</bean>
<!-- 4. conversation - persistence adapter -->
<bean id="persistentContextFactory"
class="org.apache.myfaces.orchestra.conversation.spring.JpaPersistenceContextFactory">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>

Not enough XML so far.
In my web.xml file I needed to add these entries as well:

<filter>
<filter-name>orchestraFilter</filter-name>
<filter-class>org.apache.myfaces.orchestra.conversation.jsf.filter.OrchestraServletFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>orchestraFilter</filter-name>
<servlet-name>faces</servlet-name>
</filter-mapping>
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
<listener>
<listener-class>org.apache.myfaces.orchestra.conversation.servlet.ConversationManagerSessionListener</listener-class>
</listener>

That is all you need to do.

It took me some time, to correct my xml-based typos…🙂 but than all was fine.

More about the real migration, soon!

Howdy!

Posted in apache, jsf, myfaces
2 comments on “Moving to MyFaces Orchestra…
  1. matthiaswessendorf says:

    even it doesn’t look like… you can copy the source code. the CSS isn’t smart enough, but not interested in bothering with that as well, or come and try new facesgoodies, once I committed the change😉

  2. Freenwa Doongle says:

    This is intense! But, a question: is Shale the only alternative? Or could a synthetic substitute be the answer? Shale is not very green, perhaps a synthetic form might run more efficiently at the electron interaction level, thus improving computing power by reducing inefficiency, allowing greater throughput.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: