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.

About these ads

Join the conversation! 4 Comments

  1. Why an alternate solution for Seam?

  2. we are planning to use Jboss Seam. But since we not using Seam yet, and right now we need only this kind of scope level (something between request and session), MyFaces Orchestra comes to the scene. This is a light library that only provide conversational scope (two new scopes for spring beans in fact), and others few things. And the most important: is really easy to use, and already integrated with Spring Framework. I have no doubt that the jsr 299 is a nice stuff.Hail the “King”! ; )

  3. another bright idea from apache. Every time I see this kind of tricks, I wonder why they always need to implement some proprietary thing (which apache and spring are), to get around a defined standard which had good reasons for not doing this…

  4. I don't know why, but i add DelegatingVariableResolver in my faces-config.xmland import spring-orchestra-init.xml in my web.xml, and i still avec this exception at the end of the startup.java.lang.IllegalArgumentException: Orchestra was unable to create an instance of bean with name 'AccessScopeManager'

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

Category

conversation, frameworks, javaserver faces, jsf, orchestra, programming

Tags

, , , , ,