From 8fef6a76959160bf73064be48d4aa36b48f27412 Mon Sep 17 00:00:00 2001 From: jestin Date: Mon, 6 Aug 2001 14:32:47 +0000 Subject: Theses docs have been removed from this package. What a pity ! They now belong to the ivy cvsroot. What should I do ? --- doc/html/guide/first.html | 112 ---------------------------------------------- 1 file changed, 112 deletions(-) delete mode 100644 doc/html/guide/first.html (limited to 'doc/html/guide/first.html') diff --git a/doc/html/guide/first.html b/doc/html/guide/first.html deleted file mode 100644 index 97ab74c..0000000 --- a/doc/html/guide/first.html +++ /dev/null @@ -1,112 +0,0 @@ - - - your first Ivy java application - - - - - -
- The Ivy java library guide
Prev - Next

- -

Your first Ivy java application

- -

We are going to write a "Hello world translater" for an Ivy bus. The - application will subscribe to all messages starting - with "Hello", and re-emit them after translating "Hello" into "Bonjour". In - addition, the application will quit when it receives any message containing - exactly "Bye". - -

The code

- There is the code of ivyTranslater.java: - - -
-
-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(); }
-}
-
-
- -

Compiling

-

On a Unix computer, you should be able to compile the application with the - following command : - - -
-$ javac ivyTranslater.java -
$ -
- -

Testing

-

We are going to test our application with Probe. In a terminal window, - launch ivyTranslater: - - -
-$ java ivyTranslater -
  -
- -

Then in another terminal window, launch Probe. You are then ready to - start, Type "Hello Paul", and you should get "Bonjour Paul". Then Type "Bye", - and your application should quit : - - -
-$ java fr.dgac.ivy.Probe '(.*)' -
you want to subscribe to (.*) -
broadcasting on 127.255.255.255:2010 -
IvyTranslater connected -
IvyTranslater subscribes to ^Bye$ -
IvyTranslater subscribes to ^Hello(.*) -
IvyTranslater sent 'Hello le monde' -
Hello Paul -
-> Sent to 1 peers -
IvyTranslater sent 'Bonjour Paul' -
Bye -
-> Sent to 1 peers -
IvyTranslater disconnected -
<Ctrl-D> -
$ -
- -


- - - - - - - -
PrevHomeNext
The Ivy java library Basic functions
- - -- cgit v1.1