70 likes | 270 Views
Connecting Two or More Projects in Your Workspace. You will often need to connect up two or more EGL projects in a single Workspace. This next section shows how to do so. Working With Multiple Projects.
E N D
Connecting Two or More Projects in Your Workspace You will often need to connect up two or more EGL projects in a single Workspace. This next section shows how to do so.
Working With Multiple Projects • In this course, with its small resource set we’ve structured the workspace to use only one project/EAR file combination. • This is viable for (very) small prototypes, PoCs (Proofs of Concept) and small “one-off” projects. • However, most of your medium-and larger-sized applications will require you to organize your resources with multiple projects. • This is especially true, when it comes to reusing assets, as you’ll want to create a “common code” project – consisting of reusable: • SQLRecords – and Serial, Index and basicRecords • DataItems • EGL DataTables • Optimized SQL and data access functions • Etc. …. Stored in a project that you export/import as a PIF (Project Interchange Format) file, in order to obtain reuse benefits. • See ***Notes on creating and reusing additional projects • Important – in this exercise, you will hook your EGLServiceProject up to EGLWeb. This is atypical, from a re-use perspective. More commonly you would put common code into an EGL “Batch” project (a non-web project). There will be notes upcoming on this. - See the Help topic: The EGL Build Path
Working With Multiple Projects – Source Reference-Ability – 1 of 5 • Before we cover the steps, do the following (so you can test out all of the remaining steps in this section) • From EGLServiceProject • Create a new EGL Package under \EGLSource\ named: librariesExt • Note – you should keep all packages and source files unique – across the multiple projects you intend to combine in one Workspace (or you may get Namespace issues) • In this Package create a new EGL library, named: serviceProjectLib • Create a simple function – as shown here… • Save (Ctrl/S) and generate (Ctrl/G)
Working With Multiple Projects – Source Reference-Ability – 2 of 5 • To make the source in one of your projects available to another in the same workspace, do the following: • From the project that contains the source – do nothing • From the project that wishes to reference the source in the other project (EGLWeb): • From Project Explorer, right-click and select Properties • From EGL Build Path, check the name of the project that contains the source you wish to reference • To test out your source reference-ability; From within EGLWeb, open the \EGLSource\programs\ folder, and select: builtInFunctionTest.egl • Inside the main() function, add the following three variables and using Content Assist, add a call to serviceProjectLib.testFunc(…) • Save (Ctrl/S), Generate (Ctrl/G) • But do Not run or debug • We have a few more steps to take…
Working With Multiple Projects – Source Reference-Ability – 3 of 5 • To make the generated executables (i.e. Java classes) in one of your projects available to another in the same workspace, do the following: • From the project that contains the source – do nothing • From the project that wishes to reference the source in the other project (i.e. from EGLWeb): • Using Project Explorer, right-click and select Properties • From Java Build Path, check the name of the project that contains the source you wish to reference • To test out your executable reference-ability: • Set a breakpoint in: builtInFunctionTest.egl on the call to the serviceProjectLib • From Project Explorer: • Debug the EGL Program
Working With Multiple Projects – Source Reference-Ability – 4 of 5 • The previous steps worked insofar as EGL Batch. • To make the generated executables (i.e. Java classes) in one of your projects available to an EAR file, running under WAS in the same workspace, do the following: • All the previous, and in addition: 1. Export the project with the library as a Java .jar file • Right-click • Export
Working With Multiple Projects – Source Reference-Ability – 5 of 5 2. Add it to the EGLWeb project's \lib\ folder - so that it can be resolved at runtime. \WebContent\ \WEB-INF\ \lib\ • To test out your executable reference-ability: • Create a simple web page, whose EGL JSFHandler contains three integer variables • In onConstruction() call the serviceProjectLib, passing the variables • Drag the result variable: c – onto the page as an output control and display its value