To accelerate and simplify the application delivery, OptimalJ implements the Model Driven Architecture (MDA) defined by the Object Management Group (OMG). OptimalJ's model driven architecture hides the complexity of the J2EE platform and allows you to concentrate on your business application. To help you understand the key concept driving the development process in OptimalJ, read the documentation in this section Developing an application with MDA
The following sections get you started developing by understanding the key development concepts.
By organizing your work in the IDE into projects, you can operate on the files as a whole. For example, when you compile a project, you compile all of the Java source files in it. When you have created a project you must mount a local directory to hold the project models and source code. For more information, see the tutorial Creating a new project.
Model packages are used to structure a model. When you create a root model package, select a file system (a mounted directory on disk) where your models and code are to be stored. OptimalJ can generate an initial structure for your model packages resulting in the creation of a default set of child model packages. Model packages created as children from other model packages allow you to define a contentFilter property to indicate which model elements can be created within the model package. For more information, see Model package structure.
You can create model elements in the Explorer window or using the graphical editors using context-sensitive pop-up menus. To add model elements, right-click a model element and choose New Child to display a list of valid object that can be added at that point. Wizards guide you through the creation process. The graphical editors also have toolbars in which you can create model elements by dragging and dropping the model elements icons onto the appropriate location on the diagram canvas.
The Model—>Generate Model and Update All Models menus allow you to generate and regenerate your models. Technology patterns are used to (re)generate the contents of a model package to transform the OptimalJ domain model to the application EJB, Web and DBMS models. Technology patterns link a source model package(s) from which you want to (re)generate a target model package. The generate wizards prompt you to select either a target or a source model package or model element.
When you choose the menu item Model—>Update All Models a wizard appears in which you must choose a model package. The model copiers are activated for the model package you choose and all its child model packages. Therefore, in the default tier structure you must choose the application node to generate the application, dbms, web, and ejb models. If you also want to (re)generate the service model, you must select a level higher. You can also select individual model packages for generation, or for example the integration model packages webservices, corba and jca.
You can also select a pattern icon, for example WEBEJBFromClassPattern, and choose Update Model in the pop-up menu to activate individual patterns. For more information, see Synchronizing model elements and Pattern nodes.
Default application model patterns
Generate all the source code for your application using the Model—>Generate All Code menu. Code is generated into the same mounted directory folders containing your model files, except for the Web tier code. When the generator comes to generating code for the Web tier, it prompts you to mount a directory which allows you to separate the generated code files from the model repository files.
When you update your models, you can regenerate code at model package and model element level using the Generate Codeoption in the context-sensitive pop-up menu. The generated code contains free and guarded blocks. Free blocks containing developer code do not get regenerated, thus preserving changes. The model element pop-up menu options Edit Generated Files and Edit Free Blocks in Generated Files allow you to navigate easily through the files generated for each model element.
All generated code needs to be compiled before you can run and test your application. Compile your code by selecting a folder in the Explorer [Code Model]—typically your
/application folder for ejb and dbms code and the top-level folder for your mounted Web code—and choosing Compile All in the pop-up menu.
OptimalJ features an integrated deployment environment to test your application. Testing involves:
- Setting up your SOLID database. For more information, see the tutorialSetting up a SOLID database
- Starting your EJB server. Choose Test—>Start EJB server and select your
application/ejbfolder in the dialog box as the location of your deployment descriptors.
- Starting your Web server. Choose Test—>Start Web server and select your
MainMenu.jsp(the start page of your OptimalJ application) as the main class to execute which is located in the folder where the code generated for the web model is saved.
MainMenu.jspis executed and your Web application runs in your Web browser.