Table of Contents
Table of Contents
This chapter describes how to use Kelp based on Ant tool to develop applications with XMLC for use with Enhydra 6.0. It assumes that you have a basic understanding of Enhydra and Eclipse IDE.
Kelp is a set of tools that extend a Java integrated development environment (IDE) to simplify the development of applications for Enhydra 6.0. This tools are based on Enhydra toolbox and Ant tool. Kelp dialogs is used for setting properties and running defining tasks in Ant build.xml file.
Kelp provides the following tools and features:
Kelp Application Wizard
The Kelp Application Wizard generates Web applications using either the Servlet API or the Enhydra Super Servlet programming model.
Kelp XML Compiler integration
The Kelp XMLC tool lets you set XMLC options, select markup language files (e.g., HTML, XML) to compile, and call XMLC from Ant rebuild in Enhydra Tools within the IDE to create classes that generate web content dynamically.
The XMLC properties give you control over how XMLC builds Document Object Model (DOM) classes from your markup language files (HTML,WML,..).
Kelp Deployer
The Kelp Deployer allows you to set up your project properties, copy static content to the document root, process templates, create deployable archives, and deploy the archives.
The Input Template property pages let you specify a list of strings to search and replace when you are generating files from templates (files with ".in" extension).
DODS Generator
Dods generator runs doml file for generating sql and java files.
Enhydra XMLC properties
The XMLC properties give you control over how XMLC builds Document Object Model (DOM) classes from your markup language files (HTML,WML,..).
Build integration
Through property pages, you can set up Ant rebuild task to invoke XMLC and the Kelp Deployer whenever you run Ant rebuild. This feature lets you quickly ensure that your files are updated without having to run the tools individually.
Table of Contents
This section outlines how Kelp can be used with an IDE to speed the development process. Using the Kelp tools and wizards together with those of the IDE, you can perform the following basic functions:
Within IDE you can generate a new Web Application or Enhydra Application (super-servlet style application), using the Kelp Application Wizard. The generated framework of files and directories provide a useful starting point for developing applications for Enhydra 6.0.
The Kelp project properties consist primarily of XMLC and deployment options. For additional information about XMLC, refer to Chapter 5, "Enhydra XMLC," of the Developer's Guide.
Deployment properties shows input files to include in the output deployable folder, including startup conf files and archive file.
Once you have generated or added the source files to your project, you can compile the project to generate the necessary classes. If you are using XMLC in your project, you must run the Kelp XMLC tool before compiling the rest of your source files, to include XMLC generated java files.
Note: Projects compiled or built from within the IDE do not use Ant by default. If you want to take advantage of some of the advanced Ant capabilities, use Ant rebuild task from Enhydra Tools integrated in your IDE .
After you have compiled your project you can use the Kelp Deployer to create and deploy an archive file.
if you are having trouble running your application, you can use the debugging capabilities of the IDE to isolate the problem. Debugging capabilities of the supported IDEs differ, both methods are useful. For additional information refer to "Running and Debugging Kelp Projects".
Table of Contents
Kelp provides wizards and tools that help you develop Enhydra applications from within your IDE.
The Kelp Application Wizard, shown in Figure 3.1, speeds up project development by generating the framework and source files for new applications and components. The Kelp Application Wizard uses two generators to create Enhydra projects: the Web Application generator and the Enhydra Application generator.
The Application Wizard uses the following generators:
Web application (Servlet 2.4 compatible)
Enhydra application (super-servlet style application)
Creating a new project:
To use the Kelp Application Wizard from within the IDE, create a Enhydra project beforehand, and Wizard is automaticaly invoked.
Generate Enhydra project with Kelp Application Wizard in Eclipse:
1. Open "File->New->Project..."
2. Select "Enhydra" in left, and "Enhydra Project" in right frame. Click "Next".
3. Enter project name. Click "Next" (NOTE: if you do not use default directory, directory must end with project name).
4. Click "Finish"(IMPORTANT: Do not change project properties (required libraries, source folders, etc.) setuped for Enhydra specific properties), Kelp AppWizard appear.
5. Choose "Component type" and click "Next".
6. Choose "Client Type" and click "Next". (IMPORTANT: Fields "Project directory name" and "Project root" are set from previous steps and should not be changed)
7. Click "Next" (IMPORTANT: Leave "Generate start sripts and command line build file" checked. Kelp needs build.xml file for holding project properties).
When you have finished setting the options you want, click Finish to generate your application files. When generation is complete, view the newly generated Readme.html file that has been added to your project. Readme.html shows the steps you need to build and run the application or service. The steps will vary, depending on which IDE you are using.
![]() |
Figure 3.1 Kelp Application Wizard, launched from Eclipse
For more information on the Kelp Application Wizard, see Chapter 2, "Using the Kelp Application Wizard," of the Developer's Guide. Once you create a project, you can use the Kelp XMLC tool and the Kelp Deployer tool to work with it.
In both the Kelp XMLC tool and Enhydra Deployment wizards, you use a tabbed dialog box to select files, set options, and view the build process.
The XML Compiler dialog calls XMLC, which compiles HTML and XML files into DOM classes. To open the dialog in Eclipse IDE, select Enhydra Tools-->XML Compiler (if Enhydra Tools is not visible in main manu, open "Window->Customize Perspective...", expand "Other" and check "Enhydra Tools"). The tools are available only when a project is selected.
The dialog box has three primary tabs: Selections, Options, and Output. The Selections tab, shown in Figure 3.2, displays all files in the currently selected project that are recognized as compilable by XMLC. You can use the single arrow buttons (< and >) to add or remove files from the list selected to be compiled. Use the double arrow buttons (< < and > >) to add or remove all files from the selection list. Select the Show Full File Path check box to display the full path of the files.
![]() |
Figure 3.2 Selections tab of the XML Compiler dialog
The Options tab displays following options:
Enable/disable invoking XMLC during project Ant rebuild.
NOTE for Eclipse IDE:
To run Ant rebuild task, select "Enhydra Tools"-->"Ant Rebuild" (to view log open "Window"-->"Show View"-->"Log Console").
If you want to invoke XMLC during Eclipse IDE Rebuild, use following steps:
1. Right click on project name, choose "Properties".
2. Select "External Tools Builder"-->"ant xmlc".
3. Click on "Edit" button.
4. Select check box "Run on: Full Build", click "OK".
Enable/disable verbose output.
Package name mappings. Changing mappings will affect only currently selected documents. (Recommended is to use default)
XMLC options file, allow user to edit xmlc parameters for selected options file.
![]() |
Figure 3.3 Options tab of the Kelp XMLC tool
The Output tab shows the results of running XMLC ant task based on the files you selected on the Selections tab. For information on the Output tab, see "Setting output options" .
The Output tab (Figure 3.4) is automatically selected when you click Compile in the XML Compiler dialog. This tab contains a scrollable text area that displays the results of the compile. If you have any errors in your HTML files, the problems appear on this tab. You can optionally save the output to a text file by selecting Output To Log File and entering a file name.
![]() |
Figure 3.4 Output tab of the XML Compiler dialog
The Output page displays the files that are created during the compilation process. XMLC Ant task will compile only documents changed after last compilation. If an HTML file contains a new error, the associated Java files are not regenerated.
The Kelp Deployer lets you quickly configure projects for your current environment and directory structure. The Kelp Deployer helps you perform the following four tasks:
Generate configuration files and deployment descriptors from input templates
Copy static content to your document root
Create a deployable archive, based on the type of application
Set up your project so you can launch Enhydra Multiserver with your application
This tab sets and displays basic information about deployment.
![]() |
Figure 3.5 General tab of the Deployer dialog
Enable/disable invoking deployer during project Ant rebuild.
NOTE for Eclipse IDE:
To run Ant rebuild task, select "Enhydra Tools"-->"Ant Rebuild".
If you want to invoke Deployer during Eclipse IDE Rebuild, use following steps:
1. Right click on project name, choose "Properties".
2. Select "External Tools Builder"-->"ant deploy".
3. Click on "Edit" button.
4. Select check box "Run on: Full Build", click "OK".
Deploy Type--Shows the component type("Web Application"/"Enhydra Super-servlet") to deploy.
Destination directory--Allows user to chose output folder (recommend to not change).
Make WAR--Allows user to create WAR archive for Enhydra application (for Web application WAR is created by default). This WAR can be deploy on any Servlet Container (e.g. just copy created WAR file into Tomcat4.x/webapps directory and restart Tomcat).
Include Enhydra library into WAR--Allows user to choose whether or not to include necessary jars from Enhydra lib. Select this option if Enhydra jars are not already included in Servlet Container (e.g if this jars are already placed in Tomcat4.x/common/lib directory, unselect this option).
Template Path points to the location of your project's .in files, which are template files. These files are processed and copied to your Deploy Root folder using relative paths.
![]() |
Figure 3.6 Input|Documents tab of the Deployer dialog
Documents--The Documents tab shows all template files in project input folder, which will be processed.
Select Show Full File Path to show the full path of each template file.
It is not recommended to change input folder, becouse AppWizard is generate default input templates.
![]() |
Figure 3.7 Input|Replacements tab of the Deployer dialog
Replacements--The Replacements tab lets you adjust the template settings for your project. Templates have the extension .in. Templates are text files with placeholders that are replaced with system-specific information by the Kelp Deployer (e.g. run.bat is created from run.bat.in and is used for running application inside Multiserver from console).
You can customize the search and replace mechanism by editing the data in the Replace Text table on the Options tab of the dialog. The default option lets you quickly restore the default project settings. Replacements will affect only files with ".in" extension (e.g in Figure 3.7 row "DEPLOY_PATH"|"${output.dir}" will replace token "@DEPLOY_PATH@" with value of Deploy destination directory in General tab).
You can change the order for replacements using the Move Up and Move Down buttons. Items at the top are replaced first. The Reset button sets the Replace With text back to the default values.
Show Full File Path--Displays the full path for files
Enable Input Deployment--Enables or disables input deployment. If you are using deployer for the first time, input deployment should be enabled.
Paths--The Kelp deployer will copy content types files from the content source directory (resource folder) to the content destination directory (depends on application type).
![]() |
Figure 3.8 Content|Paths tab of the Deployer dialog
Types--The Content Types subtab shows the extensions of static resource files that will be copied from the Content Source directory to your document root directory. Click Add to enter a new extension. Select an extension and click Remove to keep files with that extension from being copied. Click Reset to go to the default values of recognized extensions.
![]() |
Figure 3.9 Content|Types tab of the Deployer dialog
Also, archive will be created and placed in output/lib directory ("war" for Web Application, "jar" for Enhydra Super-servlet application).
To start dods ant based build procedure in project, start "Enhydra Tools"-->"DODS Generator" on menu.
![]() |
Figure 3.10 DODS Generator Wizard
You can start dods in Dods Generate window with one of the following parameters:
Output dir -- where to place generated files
Doml file -- path to doml file
Papers -- choose document type to generate
Extensions -- choose extensions
SQL generate -- generate sql script files
Java generate -- generate Java files
Button Cancel -- quit wizard without saving changes
Button Generate -- save changes and run DODS Generator
Button Close -- save changes without running DODS Generator.
If "Invoke DODS Generator during project Ant Rebuild" is selected, Generator will be run when Ant rebuild task is started.
NOTE:
If you want to invoke Deployer during Eclipse IDE Rebuild, use following steps:
1. Right click on project name, choose "Properties".
2. Select "External Tools Builder"-->"ant dods".
3. Click on "Edit" button.
4. Select check box "Run on: Full Build", click "OK".
Sql and java files will be generated into current project source directory.
This chapter describes how to Run and Debug Kelp project within Eclipse IDE.
After application rebuild (including XML Compiling) and deploy, need to make launch configuration for Enhydra Multiserver:
Select project, open "Run"-->"Run..." from main menu to open Launch Configurations dialog
Select "Enhydra application" and click "New" button, dialog for new configuration appears Figure 4.1.
All parameters for running Multiserver are setuped, just change the name of this new launch configuration(e.g. "HalloWorld" for HalloWorld project).
Click "Apply" button, click "Run" button.
![]() |
Figure 4.1 New launch configuration dialog for Enhydra application in Eclipse
After Launch Configuration is created (e.g. named "HalloWorld"), start debugger:
Set breakpoints in "HalloWorld" project java files.
Open "Run"-->"Debug..." from main menu to open Launch Configurations dialog
Select "Enhydra application/HalloWorld", dialog for "HalloWorld" launch configuration appears Figure 4.2.
All parameters for running Multiserver are already setuped.
Click "Debug" button, debug perspective is automaticaly opened.
![]() |
Figure 4.2 Launch configuration dialog for debug Enhydra application in Eclipse