aboutsummaryrefslogtreecommitdiff
path: root/doc/html/guide/ivyTranslater.java
diff options
context:
space:
mode:
authorjestin2000-08-16 18:08:19 +0000
committerjestin2000-08-16 18:08:19 +0000
commitbba0d7da93db5a33f5a5e16b476d4ac5b5a88be3 (patch)
tree800e6aa5fb9aea7487259e19d6cbdb9626b42b07 /doc/html/guide/ivyTranslater.java
parent32dd3ad48a8e63618db4ea17316bcc57cb778a30 (diff)
downloadivy-java-bba0d7da93db5a33f5a5e16b476d4ac5b5a88be3.zip
ivy-java-bba0d7da93db5a33f5a5e16b476d4ac5b5a88be3.tar.gz
ivy-java-bba0d7da93db5a33f5a5e16b476d4ac5b5a88be3.tar.bz2
ivy-java-bba0d7da93db5a33f5a5e16b476d4ac5b5a88be3.tar.xz
First version of java api guide.
Diffstat (limited to 'doc/html/guide/ivyTranslater.java')
-rw-r--r--doc/html/guide/ivyTranslater.java29
1 files changed, 29 insertions, 0 deletions
diff --git a/doc/html/guide/ivyTranslater.java b/doc/html/guide/ivyTranslater.java
new file mode 100644
index 0000000..696633c
--- /dev/null
+++ b/doc/html/guide/ivyTranslater.java
@@ -0,0 +1,29 @@
+import fr.dgac.ivy.* ;
+
+class ivyTranslater implements IvyMessageListener {
+
+ private Ivy bus;
+
+ ivyTranslater() {
+ // initialization
+ bus = new Ivy("IvyTranslater","Hello le monde",null);
+ bus.bindMsg("^Hello(.*)",this);
+ bus.bindMsg("^Bye$",new IvyMessageListener() {
+ // callback for "Bye" message
+ public void receive(IvyClient client, String[] args) {System.exit(0);}
+ });
+ try {
+ // starts the bus on the default domain or IVY_DOMAIN property
+ bus.start(null);
+ } catch (IvyException ie) {
+ System.err.println("can't run the Ivy bus" + ie.getMessage());
+ }
+ }
+
+ // callback associated to the "Hello" messages"
+ public void receive(IvyClient client, String[] args) {
+ bus.sendMsg("Bonjour"+((args.length>0)?args[0]:""));
+ }
+
+ public static void main(String args[]) { new ivyTranslater(); }
+}