Project name : MyFaces Alchemy

Author : Jihoon Kim [JihoonKim1004 at gmail dot com]

Draft date : May 17, 2008


1 Abstract


MyFaces Alchemy will be a subproject under the main project MyFaces that will hold JSF component libraries for additional Web 2.0 technologies such as Flex. These components will be a glue that developers will use to utilize strengths of both fields :

  1. RIA provided by Web 2.0 technologies
  2. Ease of data binding using managed beans through JSF and JEE



2 Proposal


MyFaces Alchemy will bridge the Web 2.0 technologies and JSF of JEE 1.4+ to ease the development of RIA while preserving all the beneficial aspects of both technologies.

For example, the contribution tagged along with this proposal is the bridge of Adobe Flex [which has been open sourced through MPL] and JSF. So users would create the Adobe Flex components as normal JSF components and the contribution will create the necessary preMxml, Mxml, and SWF files and link the values of the components back to the managed beans on the JSF side by using mainly JSON+Javascript+DOJO and ActionScript.

This way 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. However, in order to keep to the principle of good programming, debugging is made easy by creation of preMxml files [prequel to mxml files that get compiled to swf files] and various modes of application [debugMode, simplySWF, and productionEnv] which are later mentioned to give flexibility to users who use these components.

Technical info regarding this component library [flex] :

The components have been tested using FireFox 2.0, Opera 9.25, and IE 6.0 browsers with TomCat 5.5. Also have used Sun's JDK for Adobe Flex SDK [JAVA_HOME]

The basic design is as follows [will implement it better later]

  1. All Flex components must be nested within <s:mxmlApplication /> tag as it is the top component and this tag must be outside the <h:form /> component [due to IE's use of objects].

  2. There exists replaceMapping XMLs which will tell how to pick the fields from the components [i.e. by attributes of the UIComponent or by method call for that object].
  3. There exists templates [users can modify it if they wish to have some default capability to all similar components] which will be used per component to create preMxml files. In a nutshell, it is nothing but a simple file that contains tokens which will be replaced by component values using the replaceMapping XML and ANT's Replace Task.
  4. Necessary source files will be created to their respective directory [i.e. ActionScript file[s] that is/are needed by the system and XML file[s] that is/are needed by the ActionScript file[s] and should be defined within mxmlConstants.xml]

  5. After all the component's preMxml within <s:mxmlApplication /> have been created, MXML file and SWF file will be created using ANT by the MXMLApplication class. <s:mxmlScript /> will give capability in writing ActionScript contents as the body content of the Tag by extending UIComponentBodyTagBase. Similar flexibility is given to other Tags by extending MXMLUIComponentBodyTagBase; however it should be used sparingly and should be used mainly for components that extend MXMLUISimpleBase component. One additional thing to note is that mxmlPackageName attribute for <s:mxmlApplication /> tag will be used to name the mxml file and the swf file.

  6. Also <s:mxmlApplication /> will create JSON objects which will be rendered onto the page for initial values of the Flex components. The reason for this is because <s:mxmlApplication /> has various modes :

    1. debugMode : meaning preMxml, Mxml, and SWF files would be created in each run as well as JSON objects.
    2. simplySWF : meaning Mxml which has been modified by the user exists, so create only SWF files and JSON objects [users can use this to modify the mxml file and create a swf file]
    3. productionEnv : meaning SWF file already exists, so nothing to do here but create JSON objects [this is the default value to ensure that users do not run the components in either of the two other modes in an environment that is higher than dev]. One thing to note is that all directories of WebContent/swf/* should be copied to their corresponding directory within the Workspace during the move to higher env [since the system uses servContext.getRealPath(new String()) as the root directory of preMxml, Mxml, and swf directory and TomCat for example flushes it out to their cache directory under metadata]. For large components such as DataGrid, am planning to write it as a service in retrieving and setting the values.

  7. Uses dojo during the onLoad time to connect all the Form's onsubmit event with pageUnload function. Also each Flex/Flash app will communicate back to the page when it has finished setting up on its side [such as setting callBack methods and etcetera], JSON will be passed to the apps to set the initial values. So the values will be decoded [for example htmlText allows XML tags and etcetera, so on the Java side there will be encoding and decoding on the Flex/Flash side] and set to the component's values.
  8. During the form's onsubmit action, pageUnload will return false and make a call to Flex/Flash app to return the component's values to the page. When returned, nodes will be appended to the form that was in the process of submission and will submit the page. On the Flex/Flash side, there will be an ActionScript which will use E4X [love it] to look up within an XML file the property/attributes that the component must return as JSON objects to the page, so that the page can create the elements with their attributes as child nodes of the form element.

One note regarding preMxml files. In order to keep everything simple and debugging easy, a simple method was chosen to create the preMxml files for each component. Namely the file with mxmlPackageName_[Major Num][Minor Num].pre_mxml will be created per component within directory named WebContent/preMxml/[mxmlPackageName]/. So for instance, MxmlApplication will have Major Num and Minor Num set to 0 and the first child of MxmlApplication will have [1,0] set with it's sibling set to [1,1] and etcetera. Due to how it's written, there maybe an issue such that when depth equals a certain value and the components within that depth has 3 digits.

For example,

Since issues with this kind of scenario will occur when (1) doesn't exist [meaning sibling 120 exists and 121 is placeholder] and (2) exists [meaning [2,1] exists], this will be very rare. Also if someone has over 100+ components within a single swf file, I think it should be reconsidered and rewritten.



3 Background


The writing of this component library for this project started approximately three months ago, when enthused realization of the strong similarity between the two technologies in terms of design and architecture came about [considering both parties were part of the JSR in JCP, it made sense].

The code which had been written then was submitted as a JIRA to Apache MyFaces Tomahawk Sandbox and did attract interest of some of the community members. However, because :

  1. the size of the contribution was rather large in comparison to norm
  2. the contribution was specifically targeted to integration of Adobe Flex with JSF
  3. and the community members desired to fully ensure that all legal issues are in compliant to Apache they directed me to the Incubator. If the incubator does promote the code in the future, then it is assumed that it will be part of Apache MyFaces as its subproject.



4 Rationale


With the Web 2.0 technology flourishing within the web world, this would be a great opportunity in creating a subproject MyFaces Alchemy and bridging technologies such as Adobe Flex with JSF.

Specifically the contribution 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. Possibly may bring forth additional projects that bridge other Web 2.0 technologies with JSF
  4. Developers can be completely abstracted with Adobe Flex technology and simply create the components as normal JSF components



5 Current Status


  1. 5.1 Meritocracy

We plan to do everything possible to encourage and environment that supports a meritocracy [borrowed from Beehive within the Guide]

  1. 5.2 Community

Although the current community is simply myself, there were several individuals who showed interest within the MyFaces mailing list. Also, if this proposal is accepted and is spanned off, there is a plan to request an url to be linked from MyFace's Wiki to this project to attract additional developers. As for myself, I plan on supporting defects and additional features during bulk of my free time.

  1. 5.3 Core Developers

As mentioned in the previous section, Jihoon Kim is the sole, core developer within this project. However, it is expected that number of individuals would grow and along with it efficiency and productivity of the project [main reason that the code has been submitted as a contribution].

  1. 5.4 Alignment

With Apache MyFaces being one of the boards within the JCP community, it was envisioned that with these individuals the project will be enhanced greatly into being a truly elegant system.



6 Known Risks


  1. 6.1 Orphaned products

This project does have single developer at the current time, but the number of individuals who are interested in the project is greater than one. Meaning it is hopeful that number of individuals for the project will grow in the future and I myself will invest my time to ensure that project remains healthy.

  1. 6.2 Inexperience with Open Source

It is true that my experience with Open Source is limited, but I wish to learn greatly and wish to use this opportunity to greatly increase my knowledge about Open Source. In my spare time, I have read about Apache Maven tool through paperback and online book and learned the usage of SVN by reading the document within the main site.

  1. 6.3 Homogenous Developers

Once again there exists a single user for this project, but hopefully various developers from diverse background will join the project. Since the world is small through the web, this is rather quite likely.

  1. 6.4 Reliance on Salaried Developers

I have spoken with my manager regarding my work with open source project and he has approved the request to invest my free time in it. Also, since I do strongly feel about this project, I have no intention of allowing the deterioration of the health.

  1. 6.5 Relationships with Other Apache Products

If promoted, it is desired that this project becomes a subproject of Apache MyFaces. Also the Flex component library utilizes ANT in various tasks needed to create the SWF files for Adobe Flex.

  1. 6.6 An Excessive Fascination with the Apache Brand

Main desire in contributing the code/project to Apache is through respect of the Apache group. Like said in previous section 5.4, I truly do wish the project to be elegantly written and have spent my time in creating the initial code of the project. However, with more minds with different background looking at the code, I do hope that there will be changes made to improve efficiency and productivity of the project that I might not have seen.



7 Documentation


The following JIRA link has bulk of the information regarding the project's Flex component library => https://issues.apache.org/jira/browse/TOMAHAWK-1250



8 Initial Source


The code has been in development for the past three months and I am the solve developer who has signed the CLA.



9 Source and Intellectual Property Submission Plan


The Flex component library contribution references Adobe Flex SDK which is requested to be downloaded to developer's machine upon initial use of these components. So Flex SDK is required for debugging and creation of SWF files, but not needed outside the developer's machine. Once again Flex is open sourced as MPL.



10 External Dependencies


The dependencies all have Apache compatible licenses. These include BSD, CDDL, CPL, MPL, and MIT licensed dependencies. [borrowed from Guide]

Following dependencies include for Flex component library contribution :

  1. DOJO
  2. Flex [newer addition to MyFaces, which has MPL]

  3. ANT



11 Initial Committers


Currently I would like myself to be added as a committer to this project/repository

Of course I hope that this list will grow rapidly with individuals interested with the project. However, since I did not wish to assume individuals interested in the project desired to become committers, will simply wait until their response. Safety first.

2. Hazem Saleh [Hazems@apache.org].



12 Affiliations


Employee of IBM and have acquired permission from management to work on the project during free time.



13 Sponsors


  1. 13.1 Champion

Matthias Wessendorf

  1. 13.2 Nominated Mentors

Am looking for assistance

  1. 13.3 Sponsoring Entity

Apache MyFaces project.