DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
...
Apache Project Name : Tuscany
Mentor Name : Luciano Resende (Pending Confirmation) Resende
Link To Project Idea JIRA : Enhance Tuscany Widget Support
Proposal Content Details :
Current Intentions
1. Abstract
Apache Tuscany is provides efficient solutins for SOA implementation and it works fundamentally based on SCA standards. It provides integration across a wide variety programming platforms available today such as C++, Java, BPEL and more. As a part of it’s multiple platform support, Apache Tuscany is also integrated with web 2.0 technologies. Pojo is the only javascript framework supported by Tuscany right now.
The objective of this proposal is to generically implement a configuration option from where the user can specify the javascript framework he like to use. And as a starting step, integrate today’s most popular javascript framework i.e. jQuery, with Apache Tuscany. Once the option is in place future contributors can include more js frameworks to Apache.
2. Detailed Description
2.1
...
Modify and Reuse Existing Javascript Configuration Management
As of now Tuscany is configured to use Pojo as it's default framework. The previous contiributors have left out sufficient options to integrate a javascript framework in future. So currently those options are configured to use pojo in Java classes and other file inside the framework and is not exposed to the users to change that from outside.
| Code Block | ||||
|---|---|---|---|---|
| ||||
class DojoJavaScriptComponentGeneratorImpl {
//This is used to identify different generators supporting different JavaScript frameworks
private static final QName NAME = new QName("http://tuscany.apache.org/xmlns/sca/1.1", "component.script.generator.dojo");
private ExtensionPointRegistry extensionPoints;
private JavascriptProxyFactoryExtensionPoint javascriptProxyFactories;
public void generateJavaScriptCode(RuntimeComponent component, PrintWriter pw) throws IOException {
...
}
}
|
As a next step, the values for these options should be supplied from files which are visible and editable by the user. So by the time this step is finished the user will have a place to configure the usage of any supported javascript. The dependency files will by included according to the configuration. Currently, the pojo.js is included as shown below.
| Code Block | ||||
|---|---|---|---|---|
| ||||
class WidgetImplementationProvider implements ImplementationProvider {
private static final QName BINDING_HTTP = new QName(Base.SCA11_TUSCANY_NS, "binding.http");
...
public void start() {
String baseURI = getBaseURI();
// this uses removeServletMapping / addServletMapping as there is no getServletMapping facility
scriptURI = URI.create(baseURI + "/" + this.widgetName + ".js").toString();
Servlet servlet = servletHost.getServletMapping(scriptURI);
if (servlet == null /*|| servlet instanceof HTTPGetListenerServlet*/) {
WidgetComponentScriptServlet widgetScriptServlet;
widgetScriptServlet = new WidgetComponentScriptServlet(this.component, javaScriptGenerator);
servletHost.addServletMapping(scriptURI, widgetScriptServlet);
}
// If added to the class path, start dojo provider
if(javascriptProvider != null) {
javascriptProvider.start();
}
}
...
}
|
2.2 Implement jQuery Javascript Generator
For every pojo framework supported application there is an automatic javascript file generated that acts as a bridge between the tuscany specific javascript syntax and its counterpart in pojo framework. This javascript is generated by the following file.
| Code Block | ||||
|---|---|---|---|---|
| ||||
public class DojoJavaScriptComponentGeneratorImpl implements ComponentJavaScriptGenerator {
public void generateJavaScriptCode(RuntimeComponent component, PrintWriter pw) throws IOException {
...
generateJavaScriptHeader(component, javascriptProxyFactories,pw);
...
generateJavaScriptNamespace(pw);
...
generateJavaScriptPropertyFunction(component, pw);
...
generateJavaScriptReferenceFunction(component, javascriptProxyFactories,pw);
...
}
}
|
Similar to this file there would be a JQueryJavaScriptComponentGeneratorImpl.java and other related files that generate the javascript file for the applications configured to use javascript.
jQuery API usage
jQuery provides several ajax request options.Following are the popular ajax request present in jQuery
- load(): Load a piece of html into a container DOM.
- $.getJSON(): Load a JSON with GET method.
- $.getScript(): Load a JavaScript.
- $.get(): Use this to make a GET call and play extensively with the response.
- $.post(): Use this to make a POST call and don’t want to load the response to some container DOM.
- $.ajax(): Use this to do something when XHR fails, or you need to specify ajax options (e.g. cache: true) on the fly.
After evaluating few samples the most suitable calls would be used that suits the Tuscany architecture and modularity.
2.3 Deliverables
jQuery Javascript Generator and related files
The jQuery javascript generator files will generate all the essential files that are required to provide jQuery support for the applicaiton.
Configuration Control Location
A configuration option for the user to specify which javascript framework to use. Only the configured framework will be used on the application. This will be added as a configuration option in the existing user-accessible files such as *.composite files and would not be created as a new file.
Integration tests
Integration test modules for project deliverables with Apache Tuscany.
Documentation
User and developer documentation on Apache Tuscany web page about the new jQuery support.
2.3 Architectural outline
- User Configuration Option : User configures the application to use a specific javascript framework supported by jQuery.
- JavaScript Support File Generation : After looking up the configuration the respective javascript code generator will be invoked and generate the required files.
- Application access services via JavaScript : The running application will have the javascript support files generated automatically before the application starts. And the tuscany framework will handle all the necessary jsonrpc service calls made from the user's html pages.
Removing some hardcoded values for pojo.
2.2 Deliverables
Javascript Generator is used to implement the GUI features of the Luke application as it is Apache Licensed and can be used in the Lucene trunk.
Configuration Control
Tabbed pane is already done using Pivot API for the Luke application. There is a pane for plugins that is empty in the sandboxed version.A Tab Pane is added as a BXML file as :
...
3. Timeline
Week | Dates | Work to be done |
Week 0 | July 20th to August 2nd | Familiaring with overall Tuscany architecture and specifically with widget implementation. Discussing and prototyping implementation aspects. |
Week 1,2, | August 5th to August 25th | Implementation a of javascript code generator for jquery. |
Week 3,4 | August 26th to September 13th | Implement the the configuration option that the user can use to specify which js framework to use. |
Week 6 | September 6th to September 13th | Do the documentation for code till date |
Week 7,8 | September 16th to September 30th | Implement integration test. |
Week 9,10 | September 30th to October 14th | Open for comments for improvements from mentor and community. |
Week 11 | October 14th to October 21st | Extra Week for catching up in case of delays. Code review. |
Week 12 | October 21st to October 28th | Do documentation for code till date |