You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@incubator.apache.org by Jihoon Kim <ji...@gmail.com> on 2008/05/20 05:50:38 UTC

[PROPOSAL] FLEX and JSF integration [MyFaces Alchemy]

Hi!

My name is Jihoon Kim and I would like to propose a subproject
regarding Flex and JSF integration.

I have originally posted a JIRA regarding the contribution within the
Apache MyFaces project. But since I was the sole developer that wrote
the code, the members within the community have asked it to be
proposed within the Incubator to sort out legal issues [Adobe Flash
Player is proprietary but Flex has been open sourced through MPL] and
gathering additional developers to the project.

So technically the sponsor would be Apache MyFaces group and the
following link is to the JIRA with the contribution of the code =>
https://issues.apache.org/jira/browse/TOMAHAWK-1250

As I have yet to received a Champion for the project, I am being
hopeful that one of the readers might kindly respond back to this post
with interest in guiding me throughout the process. The following is a
rough draft of the proposal that I have written up while reading
through the process within the following site =>
http://incubator.apache.org/guides/proposal.html


Project name : MyFaces Alchemy
Author           : Jihoon Kim [JihoonKim1004 at gmail dot com]
Draft date       : May 17, 2008

================================================
1    Abstract
================================================
JSF Alchemy gives capability in creating Adobe Flex components as
MyFaces JSF components. This glue will enable developers to utilize
strengths of both technology :
   (a) RIA provided by Adobe Flex
   (b) Ease of data binding using managed beans through JSF and JEE


================================================
2    Proposal
================================================
JSF Alchemy bridges the technology of Adobe Flex [which has been open
sourced through MPL] and JSF of JEE 1.4+ to ease the development of
RIA while preserving all the beneficial aspects of both technologies.
So users would create the Adobe Flex componens as normal JSF
components and the project will create the necessary preMxml, Mxml,
and SWF files and link the values of the compoonents 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 this project/contribution.

Technical info regarding the project :

################Beginning of design#######################

The components require Adobe Flex SDK to be extracted to C:\Program
Files\flexSDK or /usr/local/bin/flexSDK [have yet to test on a linux
machine]. Optionally users can modify or pass the bin [i.e. C:\Program
Files\flexSDK\bin] to mxmlConstants.xml or JVM parameter mxmlc_bin
respectively.

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]
(1a) 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]. {the previous
statement regarding <h:form /> might not apply, as currently am making
changes to avoid it}.

(2a) 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].

(3a) 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.

(4a) 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]

(5a) 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.

(6a) 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 :
   (a) debugMode : meaning preMxml, Mxml, and SWF files would be
created in each run as well as JSON objects.
   (b) 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]
   (c) 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.

(7a) 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 with the check interval
set to 500 milliseconds. 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.

(8a) 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,
   001121 can mean
       (1) major level 1 with minor level 121 {meaning there exists at
least 121 component within the level 1}
       (2) major level 2 with minor level 1 {meaning this is a child
of [1,1] and the second sibling with depth two}

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.

################End of design#######################


================================================
3    Background
================================================
The writing of 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 :
   (a) the size of the contribution was rather large in comparison to norm
   (b) the contribution was specifically targeted to integration of
Adobe Flex with JSF
   (c) 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 bridging Adobe Flex with JSF.

The project will provide :
   (a) Easy creation of Adobe Flex applications while preserving the
ease of databinding to legacy systems through JSF
   (b) An alternative to purchasing FlexBuilder when creating simple
Flex applications
   (c) Possibly may bring forth additional projects that bridge other
Web 2.0 technologies with JSF
   (d) Developers can be completely abstracted with Adobe Flex
technology and simply create the components as
normal JSF components


================================================
5    Current Status
================================================

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

====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.

====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].

====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
=============================================================

====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.

====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.

====6.3 Homoenous 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.

====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.

====6.5 Relationships with Other Apache Products====
If promoted, it is desired that this project becomes a subproject of
Apache MyFaces. Also it utilizes ANT in various tasks needed to create
the SWF files for Adobe Flex.

====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 6.1, 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 => 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 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. 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]

Dependencies include :
   (a) DOJO
   (b) Flex [newer addition to MyFaces, which has MPL]
   (c) ANT


==============================================================
11    Initial Committers
==============================================================
Currently I would like myself to be added as a committer to this
project/repository
   Jihoon Kim [JihoonKim1004 at gmail dot com /  have submitted a CLA]

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.


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


==============================================================
13    Sponsors
==============================================================
====13.1 Champion====
Am looking for assistance

====13.2 Nominated Mentors====
Am looking for assistance

====13.3 Homoenous Developers====
Apache MyFaces project.

-- 
Sincerely,

Ji Hoon Kim

---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@incubator.apache.org
For additional commands, e-mail: general-help@incubator.apache.org