Developing Apama Applications > Developing Apama Applications in Java > Developing and Deploying Java Applications > Creating deployment descriptor files > Generating deployment descriptor files from annotations
Generating deployment descriptor files from annotations
There are two utilities that you can use to generate the deployment descriptor file from annotations in your source files:
*com.apama.jmon.annotation.DirectoryProcessor — This utility processes a directory and generates the deployment descriptor file, which you must add to your application’s JAR file.
*com.apama.jmon.annotation.JarProcessor — This utility processes an application’s JAR file and adds the deployment descriptor file to that JAR file.
You can execute these utilities from the command line or from a Java build file.
The DirectoryProcessor utility takes three optional arguments:
*-r indicates that you want to recursively process the .class files in each directory and subdirectory in the specified directory. The default is that the utility processes only the .class files that are in the specified directory.
*-d specifies the directory that contains the .class files you want to process. The default is that the utility processes any .class files in the current working directory.
*-o specifies the file in which to store the output. The default is that output goes to stdout. In the Java application JAR file, the name of the deployment descriptor file must always be jmon-jar.xml.
After you generate the deployment descriptor file, you must place it in the META-INF directory of your development directory. For example, you can execute the DirectoryProcessor utility from the command line as follows:
cd src
javac -classpath
$APAMA_CORRELATOR_HOME/lib/correlator_extension_api$APAMA_LIBRARY_VERSION.jar
*.java
java -DAPAMA_LOG_LEVEL=WARN -classpath
$APAMA_CORRELATOR_HOME/lib/correlator_extension_api$APAMA_LIBRARY_VERSION.jar
com.apama.jmon.annotation.DirectoryProcessor -r -d ./src -o
./src/META-INF/jmon-jar.xml
jar -cf ../simple-jmon.jar META-INF/jmon-jar.xml *.class
The JarProcessor utility takes one required argument, which is the name of the JAR file to operate on. To execute the JarProcessor utility from a Java build file, you can define something like the following:
<!--Target to process the annotations in the Java application classes
    to produce jmon-jar.xml -- the deployment descriptor file.
-->
<target name="process-jar" depends="jar">
  <echo message=
    "Process annotations in jar file: ${process-jar-file}" />
  <java jvm="java"
    classname="com.apama.jmon.annotation.JarProcessor" dir="."
    fork="yes">
    <classpath>
      <fileset dir="${lib-dir}">
        <patternset refid="libs" />
      </fileset>
    </classpath>
    <jvmarg value="-DAPAMA_LOG_LEVEL=WARN" />
    <arg value="${process-jar-file}" />
  </java>
</target>
 
<target name="process" depends="jar">
  <antcall target="process-jar">
    <param name="process-jar-file" value="${jar-file}" />
  </antcall>
</target>
Copyright © 2013 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or Terracotta Inc., San Francisco, CA, USA, and/or Software AG (Canada) Inc., Cambridge, Ontario, Canada, and/or, Software AG (UK) Ltd., Derby, United Kingdom, and/or Software A.G. (Israel) Ltd., Or-Yehuda, Israel and/or their licensors.