1:    public class TrackingApp extends SmWrapper {
2:
3:  private final static int timeout = 24000; / / Binding lifetime
4:  private Space sp;
5:private TrackingExpression tExp;
6:private Resource resource;
7:private LocationAverage agg;
8:
9:  public TrackingApp(){
10:     super(TrackingApp);
11:      }
12:
13:       public void run() {
14:           try{
15:      sp = new Space(null, −1); // sp = UNIVERSE
16:      tExp = new TrackingExpression(sp, motion);
17:     resource = new Resource(tExp, timeout);
18:      agg = new LocationAverage();
19:    for(inti=1;i<= 25; i++){
20:     agg = (LocationAverage)resource.access(agg, 4000);
21:    System.out.println(agg = ”+agg);
22:         Location average = (Location)agg.evaluator();
23:       if (average != null){
24:                  System.out.println(Average(“+i+”) = ”+average);
25:                 sp.updateRegion(average, 10);
26:               } else {
27:           System.out.println(Average(“+i+”) = NOTFOUND);
28:             sp.updateRegion(null,1); // sp = UNIVERSE
29:            }
30:               sleep(4000);
31:     }
32:        }  catch(Exceptione) { }
33:    }
34:
35:public static void main(String [ ] args){
36:  TrackingApp trackingApp = new TrackingApp();
37:    String [ ] types;
38:     types = new String [ 3 ] ;
39:     types [ 0 ] = “TrackingApp;
40:    types [ 1 ] = “TrackingExpression;
41:     types [ 2 ] = “LocationAverage;
42:     trackingApp.initSM(types,trackingApp);
43:    trackingApp.run();
44:     }
45: }
Listing 1: Real Java code for our object-tracking application.