]> rtime.felk.cvut.cz Git - orte/eurobot.git/blob - orte/java/src/org/ocera/orte/types/DomainEvents.java
JORTE: free() domain events
[orte/eurobot.git] / orte / java / src / org / ocera / orte / types / DomainEvents.java
1 /* DomainEvents.java */
2
3 /**
4  * Class AppInfo. 
5  *
6  * @author Lukas Pokorny (lukas_pokorny@centrum.cz)
7  * @author CTU FEE Prague - Department of Control Engineering (dce.felk.cvut.cz)
8  * @author Project ORTE - OCERA Real Time Ethernet (www.ocera.org)
9  * @author dedication to Kj
10  * @version 0.1
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 2 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  */
23
24 package org.ocera.orte.types;
25
26
27 public abstract class DomainEvents {
28   /* handler to C struct with default domain properties  */
29   private long handle = 0;
30
31
32  /* load native library 'libjorte.so' */
33   static {
34      System.loadLibrary("jorte");
35   }
36
37   public DomainEvents()
38   {
39     this.handle = jORTEDomainInitEvents();
40         System.out.println(":j: events created & initialized..");
41   }
42   
43   public long getHandle()
44   {
45         return this.handle;
46   }
47   
48   public boolean destroy()
49   {
50     System.out.println(":j: DomainEvents destroy called..");
51
52     if(!jORTEDomainEventsDestroy(this.handle)) {
53       System.out.println(":j: DomainEvents destroy fault!");
54       return false;
55     }
56     else {
57       System.out.println(":j: DomainEvents destroy successful..");
58       return true;
59     }
60   }
61   
62   public abstract void onRegFail();
63   public abstract void onMgrNew(AppInfo appInfo);
64   public abstract void onMgrDelete(AppInfo appInfo);
65   public abstract void onAppRemoteNew(AppInfo appInfo);
66   public abstract void onAppDelete(AppInfo appInfo);
67   public abstract void onPubRemoteNew(AppInfo appInfo, PubInfo pubInfo);
68   public abstract void onPubRemoteChanged(AppInfo appInfo, PubInfo pubInfo);
69   public abstract void onPubDelete(AppInfo appInfo, PubInfo pubInfo);
70   public abstract void onSubRemoteNew(AppInfo appInfo, SubInfo subInfo);
71   public abstract void onSubRemoteChanged(AppInfo appInfo, SubInfo subInfo);
72   public abstract void onSubDelete(AppInfo appInfo, SubInfo subInfo);
73   
74  /* ****************************************************************** *
75   *                                                                    *
76   *                         native methods                             *
77   *                                                                    *
78   * ****************************************************************** */
79
80
81  /**
82   * jPropDefaultGet - returns handler to default properties of a domain,
83   * if occures some error return NULL.
84   *
85   * @return handler to default properties of a domain, NULL if error
86   */
87   private native
88   long jORTEDomainInitEvents();
89
90   private native
91   boolean jORTEDomainEventsDestroy(long handle);
92 }