The JSF Flex Project


September 2008

Discussion


The goal of JavaServer Faces Flex is to provide users capability in creating Flex components as normal JavaServer Faces components. So users would create the components as normal JSF components and the project will create the necessary SWC, SWF, and other components, and link the values of the components back to the managed beans using JSON+JavaScript and ActionScript. By doing so, developers who are unfamiliar with Adobe Flex can be completely abstracted from its technology and focus in linking the application's data to legacy information. This article will provide a quick overview of the project, a brief introduction of the technical info regarding its design, and how to build the SNAPSHOT artifacts by downloading the source code to the local machine. Please note that the project is in its infancy state, so it is probable that it will undergo transformation in the future.

JSF Flex example

JSF Flex Lifecyle

The project itself will piggy back on JSF's lifecycle with one main difference being that there will exists an interlude step called buildComponentInterlude between buildComponentBegin and buildComponentChildren.

encodeBegin: buildComponentBegin buildComponentInterlude

encodeChildren: buildComponentChildren

encodeEnd: buildComponentEnd

The following image shows a brief overview of some of the steps taken during the various application modes [debugMode, simplySWF, and productionEnv].

Brief overview of JSF Flex Lifecycle

One thing to note is that buildComponentEnd II process occurs only once per application, since the existence of system resources are checked prior to creating them. Also each application is allowed various modes fit for different purposes.

JSF Flex Framework

In order to separate the core framework with its implementations, JSF Flex has componentized much of its code into several maven projects that will be linked during build time and its implementations created during runtime. This will allow users to choose their preferred implementation during build time by providing a specific profile id or providing none for the default implementations.

During build time, decision will made of which _RunnerFactory implementation the project should instantiate during runtime [default being DefaultRunnerFactoryImpl] and this implementation will dictate which implementation of _CommonTaskRunner, _FileManipulatorTaskRunner, and _FlexTaskRunner the system should instantiate during runtime. Furthermore, the decision of which implementation of _AnnotationDocletParser to instantiate during run time for specific JRE version will be made during the build time. More details regarding the above process is shown below, which provides a brief overview of each maven project.

JSF Flex Maven Projects

JSF Flex Building SNAPSHOT artifacts

Here I’ll present a brief overview of building snapshot artifacts of JSF Flex.

Checking out/Extracting the resources from the repository

Check out/extract the resources from http://jsf-flex.googlecode.com/svn/trunk/ to a folder within the local system [i.e. C:\jsfFlexProject] by using the SVN tool.

Importing the project into Eclipse IDE
  1. In the folder where the resources were checked out to, run the following command to enable importing of the projects into an Eclipse IDE [project requires maven for building] :

mvn -D wtpversion=<WTP Version of local Eclipse> eclipse:eclipse

  1. Then run mvn install within the resource directory [i.e. C:\jsfFlexProject]. This should be enough to import the projects into Eclipse IDE.
  2. Create a new workspace and navigate to File => Import => Existing Projects into Workspace.
  3. Select the folder where the resources were checked out to [i.e. C:\jsfFlexProject].
  4. Finally add the "M2_REPO" Classpath variable within the workspace:
    1. Navigate to Window => Preferences => Java => Build Path => Classpath Variables
    2. M2_REPO as variable and value as the maven2 repository [for me it was "C:/Documents and Settings/Administrator/.m2/repository"]

Projects to import

Conclusion

With the Web 2.0 technology flourishing within the web world, JSF Flex allows bridging of these two technologies which excel in their own area, Flex in creating a Rich Internet Application and Java in maintaining a robust code on the server side.

Specifically the project will provide:

  1. Easy creation of Flex applications while preserving the ease of databinding to legacy systems through JSF.
  2. An alternative to purchasing FlexBuilder when creating simple Flex applications.
  3. Complete abstraction of Flex technology.

Resources

Further details and the source code: http://code.google.com/p/jsf-flex/

Project member’s main discussion list: http://groups.google.com/group/jsf-flex/

About the Author

Ji Hoon Kim is a Software Engineer within IBM.


PRINTER FRIENDLY VERSION