SEAM Investigation

cancel
Showing results for 
Search instead for 
Did you mean: 

SEAM Investigation

resplin
Intermediate
0 0 877

Obsolete Pages{{Obsolete}}

The official documentation is at: http://docs.alfresco.com



Research For Future Features


Introduction


SEAM was recently released by Gavin King. It is 'a powerful new application framework to build next generation Web 2.0 applications by unifying and integrating popular service oriented architecture (SOA) technologies like Asynchronous JavaScript and XML(AJAX), Java Server Faces(JSF), Enterprise Java Beans(EJB3), Java Portlets and Business Process Management(BPM) and workflow'.

The purpose of this investigation is to examine it's approach for tying JSF and AJAX together. Also of interest is their integration and support of jBPM, which we are integrating into the 1.4 release.


Overview


Seam builds on the EJB3 approach of using annotations to drive everything in an attempt to reduce the amount of XML configuration you need.

In some ways, in my opinion, this actually makes it harder to get an overview of the application as you have to view the source code to see if the class represents a bean and how it behaves. On the other hand, as a result the amount of code and configuration that has to be written is definitely reduced.

Seam has eliminated the need to configure all your managed beans by using annotations, a bean is simply annotated with

@Name('myBean')

this, effectively creates a JSF managed bean called 'myBean', in Seam terms, it's called a component.

Injecting services is also handled using annotations. Seam intercepts each request to a component and injects any objects required as defined by the following annotation:

@In


AJAX Support


Seam takes a DWR type approach where a JavaScript object is exposed on the client side. To enable remoting functionality for a server side Seam component the JavaScript source is imported as follows

<script type='text/javascript' src='seam/remoting/interface.js?someBean'> </script>

Any methods on that component that have been annotated with

@WebRemote

are then callable from the client.

Once the client-side remoting framework has been included using

<script type='text/javascript' src='seam/remoting/resource/remote.js'>

the Seam object is used to call the remotable methods...

Seam.Component.getInstance('someBean').aMethod(name, callback);

Workflow Support


Seam, as you would expect, supports jBPM, it makes it fairly straight forward to write UI for process definitions and also allows process defintions to drive UI page flow.

To create an instance of a process definition a method only has to be annotated with

@CreateProcess(definition='proc-def-name')

When this method is called the process definition called 'proc-def-name' is create. To start a task a method just has to be annotated with

@StartTask

and to finish a task a method can be annotated with

@EndTask

The JSF UI simply calls these methods using the standard method binding expression and Seam, behind the scenes, makes the necessary calls to manipulate the workflow and tasks.

Conversely, process definitions (slightly modified versions in terms of syntax) can be used to drive the UI. Transitions can be used to decide which page to go to next (via JSF binding expressions), effectively replacing JSF's navigation rules. Furthermore, actions can also be called from within the definition giving a nice separation of state and business logic.