DictionaryForMIDs WebApp Translation Layer: information for developers of the WebApp Translation Layer
Overview
The WebApp Translation Layer consists of Javascript code. The Javascript code is converted from Java code with the Google Web Toolkit (GWT). Specific Javascript code is added for the data access layer (see here), exactly the same way as for Java platforms. Yes, the WebApp is simply another platform that is supported, exactly the same way as are Java platforms such as Android, JavaME an others. Exactly the same hooks are used for Javascript as for any Java platform.
The Google Web Toolkit (GWT) lacks some fundamental Java classes, because there is no Javascript equivalent. The Java class "Thread" is an example: the browser Javascript does not support multithreading (no, web workers are not multithreading; I explained this in more detail in the DfM forum). However, the Javascript code cannot be generated by GWT when these classes are not available. So, for these classes, I created simple implementations (here). With these implementations GWT does nicely generate a runnable code. Well, the limitations of browser Javascript still exist, for example the simple Javascript Thread class executes the task as a method call (i.e. no parallel execution).
How to compile the WebApp Translation Layer
Download and extract Google Web Toolkit (GWT) SDK.
Download the sources from the SVN repository, see our description for developers. For the Translation Layer you only need "DictionaryForMIDs" and "WebApp".
Run ant with the DfM build file and the target compile_dfm_webapp_t. The DfM build file calls a separate GWT build file for compiling the WebApp Translation Layer with GWT. This GWT build file is located in this directory. In that GWT file you must set the property gwt.sdk to the location where you extracted GWT.
The dfm build file produces in the subdirectory Build/WebAppTL the file
DfMTranslationLayer.js
. This file contains the WebApp Translation Layer.
Initialization of WebApp Translation Layer
The startup code of the WebApp Translation Layer is part of class TranslationLayerGWT, method onModuleLoad.
Deployment of the WebApp Translation Layer on the Sourceforge web server
Copy the file DfMTranslationLayer.js
on the web server in
the directory htdocs/WebApp/Apps/DfMTranslationLayer
.
Ensure that the file cache_dfmtranslationlayer.manifest
is
in the same directory. The file cache_dfmtranslationlayer.manifest
is responsible for caching all files of the WebApp TranslationLayer (= currently only the file
DfMTranslationLayer.js
).
How to develop a WebApp with the WebApp Translation Layer
For development of a WebApp based on the WebApp Translation Layer read here.