US7152229B2 - Workflow code generator - Google PatentsWorkflow code generator Download PDF
Info
- Publication number
- US7152229B2US7152229B2 US10346965 US34696503A US7152229B2 US 7152229 B2 US7152229 B2 US 7152229B2 US 10346965 US10346965 US 10346965 US 34696503 A US34696503 A US 34696503A US 7152229 B2 US7152229 B2 US 7152229B2
- Authority
- US
- Grant status
- Grant
- Patent type
-
- Prior art keywords
- code
- generator
- application
- method
- workflow
-/40—Transformation of program code
Abstract
Description
This application claims priority to U.S. Provisional Patent Application No. 60/350,858, filed on Jan. 18, 2002, which is fully and completely incorporated herein by reference.
This invention generally relates to a workflow code generator and more particularly, to a workflow code generator for generating code for multi-channel and/or multi-modal applications..
In the following discussion, the terms terminal, channel, mode, multi-channel application, and multi-modal application are defined as follows:
-.
- A channel refers to the medium, or the “pipe” over which the interaction takes place. The main channels of access are wireline access over the Internet, wireless access over cellular and other over-the-air networks and voice access over an analog (e.g., PSTN) network.
-.
- A multi-modal application is an application that can be accessed via two or more modes, including but not limited to real-time, disconnected, and asynchronous access..
- 1. The salesperson makes a voice call into the company's enterprise voice portal. The salesperson quickly accesses a personalized menu, and asks for the status on a specific customer account.
- 2. A large amount of information is provided regarding a customer order. Instead of listening to all the information, the salesperson asks that the information be sent to his WAP phone.
- 3. The salesperson hangs up, and immediately receives a WAP alert on his phone. The salesperson continues to interact from the WAP channel of his phone. He quickly scans the information—there are a number of updates, of which the customer needs to be informed.
- 4. The sales person forwards relevant information to the customer as an email summary, and also as an SMS message.
- 5. The sales person then stores the updated customer information to the local device store..
In view of the foregoing, it would be desirable to develop an application that will be functionally equivalent on a homogenous set of devices, each with their own development environments and hardware and software differences.
One solution would be to create different sets of applications, each developed to address the various constraints of the devices. Some possible advantages to this approach may include the following:
- Application developers can uniquely customize an application to fully utilize the resources on the particular hardware platform.
- The application developer might be more able to fully optimize the application for size and speed by learning all of the features of the hardware platform.
- This approach is also fine if the goal is to create an application that only works well on one platform.
However, there are some obvious disadvantages, such as:
-.
- As new devices appear, if development requires a different development environment, then a new code base needs to be created for the application to work on the platform.
Another approach may be to develop a middleware platform for the various architectures in their native implementation that can run applications designed to work on this middleware platform. The JAVA programming language is one such platform. As long as the device supports such a platform, an application written to run on the JAVA programming language platform will run on the device. However, the JAVA programming language not exist on all hardware platforms. In some cases, the JAVA programming language cannot be run on a platform because of resource constraints. In these cases, it is possible to create something that might behave like the JAVA programming language. However, this is reinventing something that already exists. Although the ideal would be to develop all applications in the JAVA programming language and have them run on different devices, the reality is far from this ideal. As previously mentioned, there are different device profiles (API) that still must be accounted for during code development..
Code generation moves the need for many developers to know about different hardware platforms to one central location, the code generator. In such a scenario, a code generator may contain die intelligence about the requirements of the development environments. The code generator can be made to generate C code or JAVA programming language.
The present invention provides a workflow code generator, which may be used to generate JAVA programming language based offline (device resident) applications from a unified model, which may be created by a system for creating multi-channel and/or multi-modal applications, such as the system described in the '623 patent application..
There are several issues to be concerned with while generating code for a multitude of devices. The following are some examples of problems that the workflow code generator of the present invention will solve:
- the JAVA programming language and then allows the device manufacturer's compiler to handle optimization issues specific to its hardware.
- For example, the code generator can generate JAVA programming language code that can then be compiled and run on a device that has a JAVA programming language virtual machine (JVM) installed.
- One advantage of the JVM is that it abstracts the details of CPU and hardware from the software. As long as a device implements a JVM, this is valid. Alternatively, the code generator can also generate byte-code that can be directly run on the JVM without going through a compile stage.
-.
- Some devices might not have an ANSI compliant C compiler for which the code generator could generate code. In such cases, the code generator architecture can emit code in other languages that are supported on that hardware platform.
- Note that the code generator also has the option to use one method of code generation over another to access hardware-specific features not available in some languages. For example, a JAVA programming language compiler might not have access to certain hardware features that a C compiler might have.
-).
- Even the way that applications are started could be different for different operating systems. The following is an example of how code is started in WinCE versus J2ME.
- operating system.
- For the JAVA programming language,.
- 3. Different Programming Languages—some development environments might not support development in a particular language. For example, some devices (e.g. QUALCOMM BREW) only support development in C. Others might only support development in a flavor of the JAVA programming language (e.g. RIM GPRS BLACKBERRY). Still others might only support new languages (e.g. MICROSOFT Stinger and C#). In order to create applications on all these platforms, the code generator is adapted to be aware of all these languages and language variants.
The code generator abstracts above the programming language. The code generator may be coded to be aware of how to generate code depending on the device on which the application is going to run.
- For example, on QUALCOMM.
- 4. Device Profiles—there are difficulties in writing code for software that abstracts the hardware such as the JVM. In the case of the JAVA programming language and J2ME (JAVA 2 Micro Edition—a subset of the JAVA programming language plus API for specific devices), many different profiles exist to address issues such as CPU power and screen size. For each profile, an application designer would need to learn die intricacies of that profile. The added complexity is that although a profile can be run on different devices supporting the profile, the device might take on various sizes and shapes which needs to be accounted for during application development.
- The workflow code generator is aware of all of these profiles and therefore simplifies the process for the application designer.
-) ease, the screen sizes are very small and the keys are typically the alphanumeric keys on a phone. On a PDA profile, the interaction could be through a pen interface so the API for this profile would be different.
-.
High Level Code Generation Example
- The following is a simple example of how the code generator may adjust its output for the application to function correctly on a WinCE platform and on a JAVA programming language.
Referring back to the WinCE version, to handle the workflow, the call to a workflow must return after it is done rather than executing states one-by-one. Because this is an event-driven model, the workflow processes data and instructs the view what to display next.( )” with the correct class name, whereas in J2SE, a button is a “Button” class that gets added to an Abstract Window Toolkit (AWT) container. Also, the method by which the workflow “waits” for, data to process will be different..
Note that it is possible for the WinCE version to use the method described for the J2SE version and vice-versa. However, the code generator will preferably output code that is most natural and most optimized for the existing platform..
These and other aspects, features and advantages of the present invention, as well as the invention itself, will be best understood from the following drawings and detailed description.
FIG. 8,is a block diagram illustrating a method for generating executable code, according to the present invention..
The Workflow Classes, Application Entry Points, Object Init Classes, and View Classes shown in
The JAVA programming language code generator example shows the code generator portion 110. For the JAVA programming language, there is still the issue of generating code for a particular profile (API). So, various libraries get passed into the JAVA programming language compiler 120. The compiler 120 is configured differently depending on the intended output. In a C code generator case, the system would use the C compiler that would be required to build applications for that particular device. The compiler would also be configured differently.
The next major phase after code generation is application packaging, i.e., all required files generated as described in
As shown in.
In the preferred embodiment, the code generated by workflow code generator 110 may be partitioned into three different parts, as shown the JAVA programming language, if a virtual machine supports reflection (determination of methods at run-time does not exist), then the system statically binds the names at compile-time.
Code Generation for JAVA Programming Language Example.
The example generated code fragments are for the JAVA programming language. However, this can be extended to other languages as described below. The workflow code generator examples use the CLDC profile. This is essentially a subset of the JAVA programming language programming language profiles.
General Code Generation Method Example
Although the present invention will be primarily described in relation to a method 200, it should be appreciated that each of the portions or blocks illustrated in
General System Architecture Example.
Details of Code Generation Process
In the first step in code generation, the code generator reads the input file and converts the declarative statements into an intermediate form that is more easily understood by using machine code..
This preparation process involves running the CML document through an XSL transformation document, whose result is the intermediate markup language/parse tree. The code generator will then act on the parse of this free rather than on the CML directly. Minor changes to the CML file can then be handled by modifying the XSL stylesheet to transform the document rater than modifying JAVA programming language code to do different parsing..
As part of the error discovery process mentioned above, the code generator may look for unreachable objects An unreachable object (state) is determined in the following manner:
- 1. Discover all states that need to be examined (simple enumeration of the intermediate model described above).
- 2. Traversing through this list of states one at a time.
- a. On each state, look at each transition assigned to the state.
- b. For each transition, mark the state to which the transition traverses. This can be done by annotating the node that represents the state or by creating a list where the names of the states that are traversed to can be stored.
- 3. When done traversing through the list of states, compare this list with the list of state names that are traversed to. For each state that does not exist in the traversal list, then that state can be safely eliminated from the intermediate model.
Unreachable code (actions) within a single state can also be optimized such that these unreachable actions are eliminated. This may be performed in the following manner:
- 1. Walk through the list of actions within a state. These actions include the transitions that occur.
- 2. For each action, if it is not a transition, then continue to the next action.
- 3. If it is a transition, we check if it has a condition on that transition. If it does, then continue to the next action.
- 4. The transition does not contain a condition. So, if there are actions that follow this transition, then we can safely remove those actions from the state.
For more extensive optimization, the code generator can analyze a graph to look for patterns of nodes and replace these patterns with optimized node patterns or generate specific inline code that has the same functionality of the set of nodes. This may be performed in the following manner:
- 1. A list of patterns containing state-transition-state is loaded.
- 2. Walk through each state in the workflow.
-.
While traversing through the states, the code generator may discover the various resources that are used. This can be done because the actions contained in the states refer to resources in a known manner. The resources that will be used in this case are JAVA programming language objects. References to these objects by the actions are recorded into a mapping table. An example of this mapping table includes a “key” or an index to a list of properties about that JAVA programming language object. The key could be the name of the referenced resource (e.g. variable name)
Where the resource was used, the code generator refer to the resources using a “key” that will point to the appropriate resource in the mapping storage rather than using the original resource. This key will be embedded as an annotation to the object using the resource..
After all the code assignments arc completed, the code generator emits the code to an output file. Depending on the target Language, the order by which code is emitted may be important. For example, in the JAVA programming language, the correct resources (JAVA programming language
Code Generation to the JAVA Programming Language Platform
One embodiment of the code generator is to emit JAVA programming language code. The examples in this application specifically refer to the JAVA programming language platform. As such, certain JAVA programming language platform specific specifications must be maintained in order for the generated code examples to function correctly. Below is a description of some of the procedures where the code generator can adhere to the JAVA programming language specification.
1. JAVA Programming Language Packages
import java.util.*;
import java.awt.*;.
The code generator can optionally determine which packages get used and generate import statements for those. However, all this is optional and mainly to improve code readability.
2. Default Packages and User Classes
The workflow code generator 110 a will generate various code modules as described below. Each code module can interact with each other and form the basis of the application. Note that the example code fragments and references to code have the JAVA programming language and runtime platform in mind. However, the same processes can output code to different platforms as well..
1. Code Generation for Submodels.
Note that submodels will be part of the “models” package to avoid name collisions as code is generated.
2. Code Generation for Submodel Entry Points
A submodel will be required to implement one method that will become its entry point. The method may create a variables map to store submodel variables that map viable name to a value. In one embodiment, a Hashtable data structure is used because it exists in all JAVA programming language.
3. Code Generation for Variables (Primitives)
Variables that are used in a submodel are essentially JAVA programming language objects. However, there are instances where JAVA programming language primitives (e.g. int, boolean, char) can be used. In a CDC environment where reflection is available, this is not a big issue since the code generator may wrap the primitives in a JAVA programming language primitive object wrapper in the java.lang package. Then, the code generator can blindly pass these objects into a reflected method. collect method to call. The code generator may do this by going through all the potential matches for a method since methods can be overloaded. Once found, the code generator may then generate code to either create a JAVA programming language primitive wrapper or pass the parameter into the method directly, depending on the method signature. For JAVA programming language objects, the code generator need not do anything else, as it will cast the result to the desired class type. For primitives, the code generator will cast to the primitive type to ensure that it is passing in the correct type.
4. Code Generation for State Traversals the JAVA programming language, there is no “goto” type of statement and the other constructs of break/continue to a label are not recommended. So, the code generator uses methods for states and calls other state methods to make transitions to other states.
One issue is that a method call results in a new frame created on the call stack. As calls occur, the stack grows. And the nature of a method call is that call will eventually return, resulting in an unrolling of the stack. This is not desirable behavior.
The solution is to have a central controlling method that delegates transitions to the appropriate state method call. When the state is done, it will return back to the controller method, passing it the next state to which it wishes control to traverse to.
The above code fragment is a sample of what the controller method might do (see.
5. Code Generation for States.
6. Code Generation for Action Blocks.
The main actions block is where the primary blocks of code will reside for a state. It will be generated as a loop that continues to execute until a transition is made out of the state.
The behavior that must be simulated is as follows (see
- 1. Show the view and get user input
- 2. Execute actions that might include acting on some user input
- 3. If an exception occurs, skip the remaining actions and show the template again
- 4. If there is a self-loop for the transition, remain within the loop without executing the pre- and post-action blocks
- 5. If a transition is encountered, execute all actions under the transition
- 6. If there is an exception in an action within a transition or a condition fails, then continue executing the actions
- 7. If a transition is successful and it is going out of the state, execute the post-actions block and exit the state
7. Code Generation for View Invocations.
Another goal of die design of the workflow code generator is to make it relatively simple for users to customize the generated code and make that code perform as necessary. Thus, the view has interfaces that simulate request variables, which can still be extended to handle passing JAVA programming language objects back rather than just simple strings..
Note that once the GUI is visible, control must somehow be passed to the system so that it can process events on the GUI. Unfortunately, this is a JAVA programming language).
8. Code Generation for Actions.
9. Code Generation for Set Action.
The set action operates in three different modes (see
- (1) Required assignment—if the specified request variable does not exist, it generates an error and causes the execution block in which the set action resides to fail;
- (2) Optional assignment—if the specified request variable does not exist, it skips the assignment and continues with other actions; and
- (3) Default assignment—if the specified request variable does not exist, it assigns the model variable with a specified default value.:
- Primitive types (byte, char, short, int, long, float, double)—take the string value and convert to the appropriate primitive type. In the event that the conversion cannot be made or assignment does not work, the assignment fails.
- Primitive wrappers—convert the string values to the appropriate types and then create an appropriate primitive object wrapper
- Strings—only a simple assignment is done
- Collections—append the string to the end of the collection as a string object.:
10. Code Generation for Transitions.
In the preferred embodiment, transition blocks are code generated as try-catch blocks. For example:
Transitions are code generated within the pre-, post-, action blocks. Note that transitions do not make sense in the pre- and post-action blocks. So, if a transition is defined in those blocks, an error should be generated. Otherwise, a transition may take the following form:
There are two types of transitions that are handled by the code generator: a transition to a different state, and a transition back to itself. Transition blocks are contained by an action block, which in turn exists in a loop.
a. Code Generation for Self-Transitions (Subcase of Transitions)
In order for a transition to occur within the same state, the code generator uses the JAVA programming language :
b. Code Generation for Transitions to Other States
For a transition to another state to occur, the code must return the integer ID of the state to which control is to be transferred. Since the transition block will be enclosed within a loop, the code generator uses the JAVA programming language “break” statement at the end of the transition fry:
11. Code Generation for Method Call Actions
Code generated method call actions perform method invocations on objects in the underlying platform (e.g. JAVA programming language objects). They are designed to work around the limitation of certain JAVA programming language configurations that do not implement the reflection API. Not having this API means that the application cannot dynamically determine method signatures of objects and call those methods. The code generator approach is to perform static compile-time binding.
Instead of performing the bindings as the application runs, the present method performs the binding during code generation. This involves retrieving all the parameters tat are to be passed into a desired method. Note (that the advantage of static binding is that finding the correct method for overloaded methods is not necessary. The JAVA programming language compiler can handle this issue. However, method signatures should still be matched to the submodel variables and constants that will be passed in.
a. Code Generation for Method Call Action (Return Values)
The method call begins with the determination of whether the method will return a result or not. If the method does not return a value, the code generator can continue. Otherwise, the generator will determine if the user wants to assign that value to a model variable or not..
Before assignment can take place, the code generator will determine whether the method will return a JAVA programming language primitive or a JAVA programming language object. For JAVA programming language objects, the generator can do the assignment without any further manipulation. For example,
- setVar(variable_name, . . . method call . . . );
For JAVA programming language primitives (boolean, byte, char, short, int, float double), the code generator will wrap the primitive value within JAVA programming language primitive wrapper objects. This must be done because a hash table will be used to store variable values, which only allow objects to be assigned. Below is a representative code fragment:
- setVar(variable_name, new Short((short) . . . method call . . . ));
b. Code Generation for Method Call Action (Parameters)
- char—e.g. ‘a’
- java.lang.String—e.g. “the string”
- boolean—e.g. true
- byte, short, int, long, float, double—e.g. (short)1234
- others—invalid, generate an error. There is no way to pass in an object literal.
- Users should have used a model variable containing the object in this case.
Passing in model variables has challenges of its own. The code generator compares the type of model variable versus the type that the method parameter expects. In the event that the parameter expects a primitive data type, the code generator ensures that the model variable value is a JAVA programming language:
- e.g. ((java.lang.Short)getVar(“aShortValue”)).shortValue( )
For other objects, the code generator ensures that the data type will match the type expected by the method call. After the cheek is completed, the code generator can generate the code to obtain the variable value and pass it into the method. Note that a type cast needs to occur because the getvar( ) method will return a JAVA programming language object (i.e. the hash table variable map is untyped). For example:
- e.g. (com.covigo.SomeObject)getVar(“myObject”)
The following is a sample method call:
- //Method call with return value
- setVar(“ingredients”, ((Cocktails)getVarCreate(“cocktails”, Cocktails.class)).getlngredients((java.lang.String)getVar(“index”)));
c. Code Generation for Method Call Actions on Objects.
- public Object getVarCreate(String key, Class factory) throws CovigoException;
- public Object getVarCreate(String key, Class factory, llnit init) throws CovigoException;.
12. Code Generation for Condition Actions.
The application running engine does simple comparisons using the following operators in the following precedence: ==, !=, <, >, <=, >=, ∥, &&.
Rather than implement a full-blown parser on the client, the code generator pre-processes the user-entered code into easily parsable tokens. In addition, the code generator uses a stack to put the operations on so that operator precedence rules can be implicitly represented on the stack.1==“value1” && var2<=123, the resulting array will become:
- new Object▭ {“var1”, “\”value1\”, new Integer(EXPR_EQ), “var2”, “123”, new Integer(EXPR_LE}, new Integer(EXPR_AND)};:
At runtime, the system may avoid the parse step and directly execute the commands in the list and place them on the stack. Results are placed back on the stack. Evaluation proceeds as follows:
- Get a value from the command list.
- If the value is a String object:
- If the value is “null”, then push a null on the stack.
- If it is a string constant (with double-quotes), then push the string on the stack (without the double-quotes).
- Next, try to determine if an integer constant exists. If so, convert the string to an integer and push it onto the stack.
- If it is not an integer, try to obtain the value from the request variables. If so, get the value and push it onto the stack.
- If the value cannot be retrieved from the request scope, try retrieving the variable value from the model variable hash table. If successful, push the value onto the stack.
- Otherwise, treat the identifier as a string literal and push it onto the stack.
- If the value is an Integer object, see what the operation is.
- For unary operations, pop a value from the stack, perform the operation on the popped value, and push the result back on the stack.
- For binary operations, pop two values from the stack, perform the operation on the popped values, and push the result back on the stack.
- The final result will be a value on the stack that can be popped off..
13. Code Generation for Custom Code Actions.
The code that developers will place into the code action call may be specific for a given compiler. For example, if the user enters JAVA programming language code, then the code action can only be compiled with a JAVA programming language compiler and hence will only run on the JAVA programming language platform.
In the example of the JAVA programming language, a code action call appears as follows:
- (new java_action.StartModel_State1_action0( )).exec(this);
- (new java_action.StartModel_State1_action1( )).exec(this);
- (new java_action.StartModel_State1_action2( )).exec(this);
The above code assumes that there is one custom code action per object and that the executed method is called “exec”. In this case, there is only one action per JAVA programming language class. Other implementations could include having all of the methods that are used in the project to begin one class. In this case, the workflow code generator could output something like:
- (new java_action.actions( )).exec1(this);
- (new java_action.actions( )).exec2(this);
- (new java_action.actions( )).exec3(this);
The methods in these code actions take one parameter that is a reference to the variables. The above examples all reference “this” in the JAVA programming language, which means that the object that contains these action calls contain the variables. Alternatively, these variables could have been kept in some other object.
The reference that is passed into the code action calls includes objects that implement some kind of interface that specifies how to retrieve the variables in the controller. The following is what a sample code action class looks like in the JAVA programming language..
The “getvalue” call takes one required parameter and one optional parameter. The first required parameter is the name of the variable. The second parameter is optional and specifies the location of the variables (the scope as described above).
14. Code Generation for Submodel Calls:
- 1. Pre-action block actions are executed.
- 2. Model variable mapping from the current model into the submodel occurs (passing variables to the submodel).
- 3. A call is made into the submodel, transferring control to that submodel.
- 4. The submodel executes in its own model variable scope.
- 5. The submodel finish and exits via the pseudo “exit” state.
- 6. Control returns back to the calling submodel, passing back the model variables of that submodel.
- 7. Model variable mapping from the called submodel is performed, mapping values from the called submodel to the caller's submodel.
- 8. Action block actions are performed.
- 9. If there is a self-transition, return to step #2.
- 10. Post-action block actions are performed.
- 11. Return control to the state controller, which will transfer control to the next state.
a. Code Generation for Submodel Calls (Variable Mappings).
Model variable mappings can optionally take a default value. If the “from” argument is left unspecified or the value of the variable does not exist yet, the default value will be passed to the submodel instead.
Model variable mapping may be accomplished by generating code to call a helper method that is implemented in the Submodel base class. Below is a representative code fragment:
- Hashtable vars=new Hashtable( );
- maplnVar(vars, “from”, “toMySubmodel”);
- maplnVar(vars, “from”, “to”, “defaultValue”);
- vars=(new models.MySubmodel( )).
- mapOutVars(vars, “fromMySubmodel”, “to”);
Implementations of maplnVar and mapOutVar essentially amount to setting the correct entries in the two different model variables hash table. The following are sample implementations:
Supporting Code Generators
Before the generated workflow code can execute, additional code modules must also be generated so that the workflow can exist within the device's environment. This includes an application entry point so that the underlying device platform (e.g. the JAVA programming language).
Application Entry Points
The purpose of an application entry point is to allow the runtime platform (e.g. the JAVA programming language) to run the application. This is a known location for the platform so tat the platform knows the starting point of the application. We use this so that we can start the generated code for the first workflow.
Code Generation for Application Entry Points
Each profile/configuration for the JAVA programming language has different methods of starting an application. This means that code must be generated differently depending on the desired target..
Bindings and Bean Images).
a) Code Generation for Bean Images.
The example code above avoids creating objects that need to remain in memory during the submodel's life. This is where the binding can save some memory.
During code generation, the code generator determines the type of object and the fields to initialize by using a combination of methods. In he preferred embodiment, the code generator performs as follows:
- 1. Determine if a bean image file exists that can be read from. If so, the code generator reads from it and creates an instance.
- 2. Introspect on the bean to obtain all the read/write properties.
- 3. Generate code to set those properties given the object.
- 4. If there is no bean image file, see if there is an XML version of the bean image. If so, read from it.
- 5. Parse the XML document to determine the fields and values to set for the fields.
- 6. Try creating an instance of the object to better determine what type should be assigned to the properties. If unavailable, then default to assigning strings.
- 7. If neither of the above is successful, then do not generate code. New instances of the object will be left uninitialized.
One example of bean image code initialization looks like:
Note that bean image inititializers are put into the “init” package to avoid potential name collisions during code generation.:
public class SubmodeIName_ModelVariableName_INIT implements llnit { }
The class also implements the “llnit” interface that defines two methods, create( ) and init. The create( ) method will create a new instance of the object with its fields initialized by init( ).
Code Generator for Templates.
The first step involves converting from XHTML to an intermediate markup language. This intermediate language describes the JAVA programming language.
In one embodiment, each widget implements an IFormElement. This interface defines two methods as follows: programming language objects rather than just strings..)
The following may be performed after the user interface has finished initializing in order to make the workflow wait until the user has finished submitting the page.
A submit button press will invoke the following code to release the wait, allowing the workflow to continue processing..
Form submission involves a call to the submitForm( ).
AWT Code Generation.
Finally, an AWTBrowser extent from the AbstractAWTPage class. It defines a general mechanism for adding form elements to the page. The page will set the layout to use the JAVA programming language GridBagLayout, which mimics an XHTML table clement. It will also add a scroll pane so that users can scroll to see other form elements that do not fit on a page.:
MIDP Code Generation.
The real implementation of the MIDP page is the MIDPBrowser. The MIDPBrowser defines an addElement( ).
To deal with displaying XHTML form elements, the code generator introduces page splitting to allow the user to navigate between pages without making the application designer implement code in the workflow to do this.
The code generator will still generate calls that call the addElement( ) method for each form element. The resulting code will essentially amount to one line of code per element in the show( ) method. As the addElement( ) MIDPBrowser class also listens for Commands coming from the page. When it receives the next/previous command, it will rebuild the Display to display only the appropriate widgets. The following is a sample implementation of this show( ) method.
The following is some sample generated code specifically for the MIDP API.
Handling Localization of Resources During Code Generation of Templates.
The advantage of embedding the strings within the code-generated template is that the code is faster. However, the main disadvantage is that code must be regenerated if a different locale is required..
There is also one additional issue That the code generator addresses. The message bundles are typically stored in UTF-8 format The code generator will be generating JAVA programming language code. While it is possible to output the JAVA programming language code in UTF-8, it might make it inconvenient for users to edit the code if they do not have an editor that can open a UTF-8 file. The solution is to save the generated JAVA programming language:
Packaging Components.
Using Build System to Combine the Generated Outputs and Resources Into a Complete Application..
Extending the Approach Described in Present Invention to Generate Code in Other Languages
The foregoing examples were specific to the JAVA programming language..
As such, transitions are like “goto” or “jump” statement. A state is simply a location in code. This can be specified as a label for a compiler or as shown in the JAVA programming language example, a method that can be called.
For the user interaction, there needs to be a standard way for the view to communicate with the workflow. The preferred embodiment utilizes a simple “in” interface where values are associated with names in a name-value paired list. The workflow can then identify values to retrieve by name. Other methods can also be used. For WINDOWS operating system COM, the workflow can perform a query on a view abject to retrieve all of the properties of that object. Then, user-entered data can be stored in the properties.
For calls to sub-models or sub-controllers, a new stack frame is created. So, this can be implemented as a method call in the programming language. If the language does not support method calls, then a data structure can be created to store data in different scopes.
The only other requirements of the language to generate code for are some kind of branch and some method of performing comparisons. This is for the conditions that can exist on transitions to determine whether the transition should be taken or not.
So, there are actually many ways to output the code. What the workflow does is to use a simple state-transition diagram that forms the basis of computing. From this basic diagram, code is generated for a particular language..
It should be understood that the inventions described herein are provided by way of example only and that numerous changes, alterations, modifications, and substitutions may be made without departing from the spirit and scope of the inventions as delineated within the following claims.