A PEAR (Processing Engine ARchive) file is a standard package for UIMA (Unstructured Information Management Architecture) components. The PEAR package can be used for distribution and reuse by other components or applications. It also allows applications and tools to manage UIMA components automatically for verification, deployment, invocation, testing, etc. Please refer to the PEAR Reference chapter for more information about the internal structure of a PEAR file.
This chapter describes how to use the PEAR Eclipse Plugin to create PEAR files for standard UIMA components. This plugin is installed if you followed the directions in Chapter 3, UIMA SDK Setup for Eclipse .
Using the PEAR Eclipse Plugin involves the following two steps:
First, create a project for your UIMA component:
Then, add the UIMA nature to your project by clicking on "Add UIMA Nature" in the context menu (right-click) of your project. Click "Yes" on the "Adding UIMA custom Nature" dialog box. Click "OK" on the confirmation dialog box.
17. Adding the UIMA Nature
Adding the UIMA nature to your project creates the PEAR structure in your project. The PEAR structure is a structured tree of folders and files, including the following elements:
For more information about the PEAR structure, please refer to the "Processing Engine Archive" section.
Before using the PEAR Generation Wizard, make sure you add all the files needed to run your component including descriptors, jars, external libraries, resources, and component analysis engines (in the case of an aggregate analysis engine), etc. It’s recommended to generate a jar file from your code as an alternative to building the project and making sure the output folder (bin) contains the required class files.
Then, click on "Generate PEAR file" from the context menu (right-click) of your project, to open the PEAR Generation wizard, and follow the instructions on the wizard to generate the PEAR file.
The first page of the PEAR generation wizard is the component information page. Specify in this page a component ID for your PEAR and select the main Analysis Engine descriptor. The descriptor must be specified using a pathname relative to the project’s root (e.g. "desc/MyTAE.xml). The component id is a string that uniquely identifies the component. It should use the JAVA naming convention (e.g. com.ibm.uima.mycomponent).
Optionally, you can include specific Collection Iterator, CAS Initializer, or CAS Consumers. In this case, specify the corresponding descriptors in this page.
Figure
19. The component Information
page
The installation environment page is used to specify the following:
Path names should be specified using macros (see below), instead of hard-coded absolute paths that might work locally, but probably won’t if the PEAR is deployed in a different machine and environment.
Macros are variables such as $main_root, used to represent a string such as the full path of a certain directory.
These macros should be defined in the PEAR.properties file using the local values. The tools and applications that use and deploy PEAR files should replace these macros (in the files included in the conf and desc folders) with the corresponding values in the local environment as part of the deployment process.
Currently, there are two types of macros:
The Installation Environment Page
The last page of the wizard is the "PEAR file Export" page, which allows the user to select the files to include in the PEAR file. The metadata folder and all its content is mandatory. Make sure you include all the files needed to run your component including descriptors, jars, external libraries, resources, and component analysis engines (in the case of an aggregate analysis engine), etc. It’s recommended to generate a jar file from your code as an alternative to building the project and making sure the output folder (bin) contains the required class files.
Note: If you are relying on the class files generated in the output folder (usually called bin) to run your code, then make sure the project is built properly, and all the required class files are generated without errors. In this case make sure your output folder (e.g. $main_root/bin) is in the classpath (see the "Installation Environment" page.