Developing Apama Applications > Developing Apama Applications in Java > Developing and Deploying JMon Applications > Steps for developing JMon applications in Apama Studio
Steps for developing JMon applications in Apama Studio
The procedure for developing JMon applications in Apama Studio is as follows:
1. Add Java support to a project.
To create a new project with Java support:
a. Select File > New > Apama Project.
b. Enter a project name and click Next.
c. At the bottom of the dialog, select Add Apama Java support and click Finish.
To add Java support to an existing project:
a. Right click the project in the Project Explorer panel.
b. Select Apama > Add Apama Java Nature.
When a project has Java support, Apama Studio does the following:
*Uses ApamaJavaLibrary to add all necessary JAR files to the project’s Java build path.
*Creates and updates the jmon-jar.xml file. This is the deployment descriptor file required by each JMon application. Inside the correlator, the JVM processes the deployment descriptor file and uses it as a guide to the event types and monitor classes to load.
*Generates and maintains your application’s JMon JAR file in the project_name java application files folder of your project.
If you select Apama > Add Java Nature you are adding standard Eclipse Java support to your project. Selection of Add Apama Java Nature includes standard Eclipse Java support.
2. Create your application's source files.
Select File > New > Java Event or select File > New > Java Monitor.
Or, in the Project Explorer, right-click your project and select New > Java Event or select New > Java Monitor.
A wizard appears that lets you specify the event or monitor’s name, the package, a description, the Java source folder and Java package. Apama Studio automatically adds an entry for the event or monitor to the jmon-jar.xml deployment descriptor file and regenerates the JMon JAR file to include the new event or monitor.
If you want to build your JAR files manually, right-click your project and select Apama > Build JAR Files. This is useful if you unselected the Build jar files automatically option in the apama_java.xml file, which is in the config directory of your project. One reason you might not want to build the JAR files automatically is that the build takes too long. When Build jar files automatically is selected, Apama Studio builds the JAR files every time you modify a JMon file.
If there are events that you defined in JMon and you refer to those events, or listen for those events in EPL code, then you must define those events in EPL as well as JMon. If you do not also define the events in EPL, Apama Studio flags EPL references to those events as errors.
See also Creating new files for JMon applications.
3. Create your application's launch configuration.
Apama Studio adds all JMon JAR files to the correlator initialization list and all non-JMon JAR files to the correlator class path.
If you want to build your project's files outside Apama Studio and Eclipse right-click your project and select Apama > Generate Ant Buildfiles. Apama Studio generates an ant build file (with the name build-project-name.xml), which you can use only to build your project’s JMon JAR files outside of the Eclipse environment. Note that this is unrelated to the Apama Studio feature for exporting an Ant build file that you can use for deployment.
See Defining custom launch configurations.
4. Run and test your application.
See Launching Projects.
5. Debug your application.
See Debugging JMon Applications.
6. Deploy your application.
See Deploying JMon applications.
Apama Studio generates your application’s JMon JAR file in the jmon_config_name java application files folder of your project’s directory. By default, jmon_config_name is the project name.
You can manage the content of the JMon JAR file and jmon-jar.xml file by using the Apama Studio editor to update the apama_java.xml file, which is located in the project’s config folder. You can use the Apama Studio editor to do the following:
*Set JMon metadata.
*Set the injection order of the events and monitors.
*Add non-JMon Java classes to the JMon JAR files.
*Add JMon classes that were not created by Apama Studio wizards to the JMon JAR file.
Copyright © 2013-2015 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.
Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG.