These days I was looking an alternative solution to JBoss Seam, to provide conversation scope to my JavaServer Faces backing beans, and I wanted that this new solution be easily integrated with Spring Framework and others frameworks used in the application, like JBoss RichFaces, Facelets, Hibernate.
So I’ve found the MyFaces Orchestra project through this video, recorded at JSFDays 2008 in a session of Thomas Spiegl and Mario Ivankovits, both of Apache MyFaces project.
About MyFaces Orchestra
Orchestra is a small library that can be used in web applications to provide the following features:
- A conversation (aka dialog) scope for beans.
- Conversation-scope persistence contexts. This fixes the dreaded LazyInitializationException or NonUniqueObjectException problems when working with persistent objects.
- Declarative transaction annotations (java1.5 only).
- A “dynaForm” JSF component that helps create forms for editing persistent data.
Orchestra requires that Spring 2.x be used to declare managed beans that will be stored in conversation context.
There are no other significant dependencies or structural requirements for code that uses Orchestra (in particular, no requirement to use EJBs).
Also, Orchestra works with any JSF implementations (e.g. JSF-RI, MyFaces).
Some Highlights
- It works with a Java 1.4-compliant syntax, but you can optionally use annotations
- It utilizes the powerful Spring bean configuration mechanism instead of JSF’s managed-bean facility. The release of Spring 2.0 made it possible to define custom bean scopes in Spring. If a JSF Managed bean is declared in Spring using the Orchestra “conversation” scope, then when that bean is referenced from a JSF EL expression it is automatically created within that conversation scope. It is not necessary for non-conversation-scoped managed beans to be declared via Spring, although we do recommend it: request and session scopes are also supported and you benefit from having one common syntax for defining the beans of your application, from the AOP features Spring provides, and from Spring’s other advanced features.
- A plus for integrating Orchestra into existing applications: If you configure your application to use Orchestra, whenever the conversational context is opened, Spring configured DAOs and BOs automatically use the new context and gain from the conversational features of Orchestra. Minimal effort for maximal results!
- MyFaces Orchestra is know to be compatible to persistence frameworks such as Toplink and Hibernate (and generally any JPA-implementation). However, any persistence framework can be plugged into Orchestra.
- The Orchestra API can be adapted to use other web frameworks than JSF.
- Orchestra sports a very easy to use API – maximum 3 method calls, and you’re ready to go.
Installation
You can read here the installation guide. It is very simple and easy to understand if you are already familiar with Spring.
Note: to make the variable lookup of beans configured in Spring work correctly, you have to configure the DelegatingVariableResolver in your faces-config.xml.
<application>
…
<variable-resolver>org.springframework.web.jsf.DelegatingVariableResolver</variable-resolver>
</application>
This way you not get the following exception at each request:
java.lang.IllegalArgumentException: No AccessScopeManager found.
Probably you forgot to add <import resource=”classpath*:/META-INF/spring-orchestra-init.xml” /> to your spring configuration.
More informations at http://myfaces.apache.org/orchestra/index.html, and in project wiki at http://wiki.apache.org/myfaces/Orchestra.
Like this:
Like Loading...
Why an alternate solution for Seam?