From bba0d7da93db5a33f5a5e16b476d4ac5b5a88be3 Mon Sep 17 00:00:00 2001 From: jestin Date: Wed, 16 Aug 2000 18:08:19 +0000 Subject: First version of java api guide. --- doc/html/guide/advanced.html | 33 +++++++++++ doc/html/guide/basic.html | 121 ++++++++++++++++++++++++++++++++++++++ doc/html/guide/contact.html | 27 +++++++++ doc/html/guide/first.html | 112 +++++++++++++++++++++++++++++++++++ doc/html/guide/index.html | 46 +++++++++++++++ doc/html/guide/ivyTranslater.java | 29 +++++++++ doc/html/guide/javalib.html | 53 +++++++++++++++++ doc/html/guide/style.html | 27 +++++++++ doc/html/guide/what.html | 38 ++++++++++++ 9 files changed, 486 insertions(+) create mode 100644 doc/html/guide/advanced.html create mode 100644 doc/html/guide/basic.html create mode 100644 doc/html/guide/contact.html create mode 100644 doc/html/guide/first.html create mode 100644 doc/html/guide/index.html create mode 100644 doc/html/guide/ivyTranslater.java create mode 100644 doc/html/guide/javalib.html create mode 100644 doc/html/guide/style.html create mode 100644 doc/html/guide/what.html (limited to 'doc/html/guide') diff --git a/doc/html/guide/advanced.html b/doc/html/guide/advanced.html new file mode 100644 index 0000000..385d67b --- /dev/null +++ b/doc/html/guide/advanced.html @@ -0,0 +1,33 @@ + + + ivy java advanced functions + + + + + +
+ The Ivy java library guide
Prev + Next

+ +

Advanced functions

+ +

Utilities

+
  • fr.dgac.ivy.TestIvySwing: to be completed +
  • fr.dgac.ivy.TestIvy: to be completed +
  • fr.dgac.ivy.Probe: to be completed + +

    Direct Messages

    +

    to be completed + +


    + + + + + + + +
    PrevHomeNext
    Basic functions Programmer's style guide
    + + diff --git a/doc/html/guide/basic.html b/doc/html/guide/basic.html new file mode 100644 index 0000000..ae5daa0 --- /dev/null +++ b/doc/html/guide/basic.html @@ -0,0 +1,121 @@ + + + ivy java basic functions + + + + + +
    + The Ivy java library guide
    Prev + Next

    + +

    Basic functions

    + +

    Initialization and Ivy loop

    + +

    Initializing a java Ivy agent is a two step process. First of all, + you must create an fr.dgac.ivy.Ivy object. Once this object + is created, you can add subscriptions to Ivy events, be it messaged, + arrival or departure of other agents, etc, but your agent is still not + connected. In order to connect, you should call the start() + method on your Ivy object. This will run two threads that will + remain active until you call the stop() method on your Ivy + object. Once the start() method has been called, your agent is ready + to handle messages on the bus ! + +

    Here are more details on the Ivy constructor: + + +
    + fr.dgac.ivy.Ivy(java.lang.String name, java.lang.String message, IvyApplicationListener appcb) +
      +
    + This constructor readies the structures for the software bus connexion. It + is possible to have different busses at the same time in an application, be + it on the same bus or on different ivy busses. +

  • The name is the name of the application on the bus, + and will by transmitted to other applicatino, and possibly be used + by them. +
  • The message is the first message that will be sent + to other applications, with a slightly different broadcasting scheme + than the normal one ( see The Ivy architecture and procotol + document for more information). If message is null, nothing + will be sent. +
  • appcb, if non null, is an object implementing the + IvyApplicationListener interface. Its different methods will be called + upon arrival or departure of an agent on the bus, when your application + itself will leave the bus, or when a direct message will be sent to your + application. + +

    Here are more details on the start() method: + +
    +public void start(java.lang.String domainbus) throws IvyException +
      +
    + + This method connects the Ivy bus to a domain or list of + domains. domainbus is a string of the form 10.0.0:1234, + it is similar to the netmask without the trailing .255. This will + determine the meeting point of the different applications. Right + now, this is done with an UDP broadcast. Beware of routing problems + ! You can also use a comma separated list of domains, for instance + "10.0.0.1234,192.168:3456". If the domain is null, the API + will check for the property IVY_DOMAIN, if not present, it + will use the default bus, which is 127.255.255.255:2010, and requires + a loopback interface to be active on your system. This method will spawn two + threads, one listening to broadcasts from other agents, and one listening on + the service UDP socket, where remote agent will come and connect. +

    If an IvyException is thrown, your application is not able to talk to the + domain bus. + +

    Here are more details on the stop() method: + +
    +public void stop() +
      +
    + This methods stops the threads, closes the sockets and does some clean up. + You can reconnect to the bus by calling start() once again. + +

    Emitting messages

    + + Emitting a message is much like writing a string on a output stream. The + message will be sent if you are connected to the bus. + + +
    +public int sendMsg(String s) +
      +
    + Will send each remote agent the substring in case there is a regexp + matching. The int result is the number of messages actually sent. + +

    Subscribing to messages

    + + Subscribing to messages consists in binding a callback function to a message pattern. Patterns are described by regular expressions with captures. When a message matching the regular expression is detected on the bus, the callback function is called. The captures (ie the bits of the message that match the parts of regular expression delimited by brackets) are passed to the callback function much like options are passed to main. Use the bindMsg method to bind a callback to a pattern, and the unbindMsg method to delete the binding. + + +
    +public int bindMsg(String regex, IvyMessageListener callback) +
    public void unBindMsg(int id) +
      +
    + + The regex follows the gnu.regexp regular expression syntax. +Grouping is done with parenthesis. The callback is an object implementing the +IvyMessageListener interface, with the receive method. The thread listening on +the connexion with the sending agent will execute the callback. + +


    + + + + + + + +
    PrevHomeNext
    Your first ivy java application Advanced Functions
    + + diff --git a/doc/html/guide/contact.html b/doc/html/guide/contact.html new file mode 100644 index 0000000..a4b3fed --- /dev/null +++ b/doc/html/guide/contact.html @@ -0,0 +1,27 @@ + + + Contacting the ivy java authors + + + + + +
    + The Ivy java library guide
    Prev +

    + +

    Contacting the authors

    + +

    The Ivy C library was mainly written by Francois-Régis Colin, and Yannick Jestin. For bug reports or comments on the library itself or about this document, please send them an email: fcolin@cena.fr and jestin@cena.fr. For comments and ideas about Ivy itself (protocol, applications, etc), please use the Ivy mailing list: ivy@tls.cena.fr. + +


    + + + + + + + +
    PrevHome
    Previous title 
    + + diff --git a/doc/html/guide/first.html b/doc/html/guide/first.html new file mode 100644 index 0000000..97ab74c --- /dev/null +++ b/doc/html/guide/first.html @@ -0,0 +1,112 @@ + + + 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
    + + diff --git a/doc/html/guide/index.html b/doc/html/guide/index.html new file mode 100644 index 0000000..895afe8 --- /dev/null +++ b/doc/html/guide/index.html @@ -0,0 +1,46 @@ + + + + The Ivy java library guide + + + +

    The Ivy Java library guide

    + +

    François-Régis Colin +
    Yannick Jestin + +

    Copyright © 2000 Centre d'Études de la Navigation Aérienne + +

    This document is a programmer's guide that describes how to use the Ivy + Java library to connect applications to an Ivy bus. This guide describes + version 3.0 of the library + +


    + + Table of Contents + +

    Foreword +
    What is Ivy ? +
    The Ivy java library +
    Your first java ivy application +
    Basic functions +
    Advanced functions +
    Programmer's style guide +
    Contacting the authors + +

    Foreword

    + +

    This document was written in HTML. The authors are aware that this is + probably not the best format for programming documentation, especially with + regard to printing. However, a documentation was needed fast. This document + is both incomplete and ugly. + +


    +
    + Next +
    What is ivy? +
    + + + 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(); } +} diff --git a/doc/html/guide/javalib.html b/doc/html/guide/javalib.html new file mode 100644 index 0000000..2738e54 --- /dev/null +++ b/doc/html/guide/javalib.html @@ -0,0 +1,53 @@ + + + The Ivy java library + + + + + +
    + The Ivy java library guide
    Prev + Next

    + +

    The Ivy java library

    + +

    What is it?

    +

    The Ivy J library (aka ivy-java) is a java package that allows you to + connect applications to an Ivy bus. You can use it to write applications + in java 1.1 +

    You can also use it to integrate any thread-safe java application. +

    The Ivy java library is known to compile and work in WindowsNT and Linux + environments. There are reported bugs for the java 2 jdk1.3 platform. + It should be easy to use on most java environments. +

    The Ivy java library was originally developed by François-Régis Colin and + Yannick Jestin at CENA. It is maintained by a group at CENA (Toulouse, + France) + +

    Getting and installing the Ivy java library

    + You can get the latest versions of the Ivy C library from CENA + (http://www.tls.cena.fr/products/ivy/). We plan to package it according + to different distribution formats, such as .msi (Windows), .deb (Debian) or + .rpm (Redhat). +

    The package is distributed as a JAR file. In order to use it, either add + it in your CLASSPATH, or put the jar in your $JAVA_HOME/jre/lib/ext/ + directory, if you use a jdk1.2. The package contains the documentation, + the sources and the class files for the fr.dgac.ivy package. +

    In order to test the presence of Ivy on your system once installed, run + the following command: +

    +$ java fr.dgac.ivy.TestIvy
    +  
    + +


    + + + + + + + +
    PrevHomeNext
    What is Ivy? Your first Ivy application
    + + diff --git a/doc/html/guide/style.html b/doc/html/guide/style.html new file mode 100644 index 0000000..70df3bf --- /dev/null +++ b/doc/html/guide/style.html @@ -0,0 +1,27 @@ + + + ivy java programmer's style guide + + + + + +
    + The Ivy java library guide
    Prev + Next

    + +

    programmer's style guide

    + +

    to be completed + +


    + + + + + + + +
    PrevHomeNext
    Advanced functions Contacting the Authors
    + + diff --git a/doc/html/guide/what.html b/doc/html/guide/what.html new file mode 100644 index 0000000..355f2b0 --- /dev/null +++ b/doc/html/guide/what.html @@ -0,0 +1,38 @@ + + + What is Ivy? + + + + + +
    + The Ivy java library guide
    Prev + Next

    + +

    What is Ivy?

    +

    Ivy is a software bus designed at CENA (France). A software bus is + a system that allows software applications to exchange information + with the illusion of broadcasting that information, selection being + performed by the receiving applications. Using a software bus is very + similar to dealing with events in a graphical toolkit: on one side, + messages are emitted without caring about who will handle them, and on + the other side, one decide to handle the messages that have a certain + type or follow a certain pattern. Software buses are mainly aimed at + facilitating the rapid development of new agents, and at managing a + dynamic collection of agents on the bus: agents show up, emit messages + and receive some, then leave the bus without blocking the others. + +

    Ivy is implemented as a collection of libaries for several languages and platforms. If you want to read more about the principles Ivy before reading this guide of the java library, please refer to The Ivy sofware bus: a white paper. If you want more details about the internals of Ivy, have a look at The Ivy architecture and protocol. And finally, if you are more interested in other languages, refer to other guides such as The Ivy C library guide or The Ivy Perl library guide. All those documents should be available from the Ivy Web site at http://www.tls.cena.fr/products/ivy/. + +


    + + + + + + + +
    PrevHomeNext
    The Ivy java library guide The Ivy java library
    + + -- cgit v1.1