Apama 10.7.2 | Developing Apama Applications | Developing Apama Applications in Java | Developing and Deploying JMon Applications | Creating deployment descriptor files | Sample source files with annotations
 
Sample source files with annotations
Following are two sample source files with annotations. These are the source files for the simple sample application provided with Apama. The lines with the annotations are in bold typeface for your convenience.
Here is the Simple.java file with comments removed:
import com.apama.jmon.*;
import com.apama.jmon.annotation.*;
 
@Application(name = "Simple",
    author = "Moray Grieve",
    version = "1.0",
    company = "Apama",
    description = "Deployment descriptor for the Simple JMon monitor",
    classpath = ""
    )
 
@MonitorType(description = "A simple JMon monitor, used to show
    functionality of a new installation.")
public class Simple implements Monitor, MatchListener {
 
   public Simple() {}
 
   public void onLoad() {
     EventExpression eventExpr = new EventExpression(
         "all Tick(*, >10.0):t");
     eventExpr.addMatchListener(this);
   }
   public void match(MatchEvent event) {
     Tick tick = (Tick)event.getMatchingEvents().get("t");
     tick.emit();
   }
}
Here is the Tick.java file with comments removed:
import com.apama.jmon.Event;
import com.apama.jmon.annotation.*;
 
@EventType(description = "Event which signals a stock trade")
public class Tick extends Event {
 
  public String name;
  public double price;
  public Tick() {
    this("", 0);
  }
 
  public Tick(String name, double price){
     this.name = name;
     this.price = price;
   }
}