|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--fr.dgac.ivy.Ivy
Field Summary | |
protected int |
applicationPort
|
static java.lang.String |
DEFAULT_DOMAIN
the domain for the UDP rendez vous |
static int |
DEFAULT_PORT
the port for the UDP rendez vous, if none is supplied |
static java.lang.String |
libVersion
the library version, useful for development purposes only, when java is invoked with -DIVY_DEBUG |
static int |
PROCOCOLVERSION
the protocol version number |
protected java.lang.String |
ready_message
|
protected java.util.Hashtable |
regexp_out
|
protected java.util.Hashtable |
regexp_out_RE
|
static int |
TIMEOUTLENGTH
|
Constructor Summary | |
Ivy(java.lang.String name,
java.lang.String message,
fr.dgac.ivy.IvyApplicationListener appcb)
Readies the structures for the software bus connexion. |
Method Summary | |
int |
addApplicationListener(fr.dgac.ivy.IvyApplicationListener callback)
adds an application listener to a bus |
int |
bindMsg(java.lang.String regexp,
fr.dgac.ivy.IvyMessageListener callback)
Subscribes to a regular expression. |
void |
connect(fr.dgac.ivy.IvyClient client)
|
void |
dieReceived(fr.dgac.ivy.IvyClient client,
int id)
invokes the application listeners when we are summoned to die then stops |
void |
directMessage(fr.dgac.ivy.IvyClient client,
int id,
java.lang.String msgarg)
|
java.lang.String |
domains(java.lang.String toparse)
|
static java.lang.String |
getDomain(java.lang.String domainbus)
|
java.util.Vector |
getIvyClients()
gives the names of IvyClient(s) |
java.util.Vector |
getIvyClientsByName(java.lang.String name)
gives a list of IvyClient(s) with the name given in parameter |
static void |
main(java.lang.String[] args)
|
fr.dgac.ivy.Ivy.Domain[] |
parseDomains(java.lang.String domainbus)
|
void |
removeApplicationListener(int id)
removes an application listener |
void |
run()
|
int |
sendMsg(java.lang.String message)
Performs a pattern matching according to everyone's regexps, and sends the results to the relevant ivy agents. |
void |
sendToSelf(boolean b)
Toggles the sending of messages to oneself, the remote client's IvyMessageListeners are processed first, and ourself afterwards. |
void |
start(java.lang.String domainbus)
connects the Ivy bus to a domain or list of domains. |
void |
stop()
disconnects from the Ivy bus |
void |
unBindMsg(int id)
unsubscribes a regular expression |
boolean |
unBindMsg(java.lang.String re)
unsubscribes a regular expression |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int PROCOCOLVERSION
public static final int DEFAULT_PORT
public static final java.lang.String DEFAULT_DOMAIN
public static final java.lang.String libVersion
protected int applicationPort
protected java.util.Hashtable regexp_out
protected java.util.Hashtable regexp_out_RE
protected java.lang.String ready_message
public static final int TIMEOUTLENGTH
Constructor Detail |
public Ivy(java.lang.String name, java.lang.String message, fr.dgac.ivy.IvyApplicationListener appcb)
name
- The name of your Ivy agent on the software busmessage
- The hellow message you will send once readyappcb
- A callback handling the notification of connexions and
disconnections, may be nullstart(java.lang.String)
Method Detail |
public void start(java.lang.String domainbus) throws IvyException
domainbus
- a domain 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.
IvyException
public fr.dgac.ivy.Ivy.Domain[] parseDomains(java.lang.String domainbus)
public void stop()
public void sendToSelf(boolean b)
The IvyClient provided to the receive() callback is a bit special. Don't even try something else than getApplicationName on it...
public int sendMsg(java.lang.String message)
There is one thread for each client connected, we could also create another thread each time we send a message.
message
- A String which will be compared to the regular
expressions of the different clients
public int bindMsg(java.lang.String regexp, fr.dgac.ivy.IvyMessageListener callback)
Example:
the Ivy agent A performs
b.bindMsg("^Hello (*)",cb);
b2.sendMsg("Hello world");
regexp
- a perl regular expression, groups are done with parenthesiscallback
- any objects implementing the IvyMessageListener
interface, on the AWT/Swing framework
public void unBindMsg(int id) throws IvyException
id
- the id of the regular expression, returned when it was bound
IvyException
public boolean unBindMsg(java.lang.String re)
public int addApplicationListener(fr.dgac.ivy.IvyApplicationListener callback)
callback
- is an object implementing the IvyApplicationListener
interface
public void removeApplicationListener(int id)
id
- the id of the application listener to removepublic void connect(fr.dgac.ivy.IvyClient client)
public void dieReceived(fr.dgac.ivy.IvyClient client, int id)
public void directMessage(fr.dgac.ivy.IvyClient client, int id, java.lang.String msgarg)
public java.util.Vector getIvyClients()
public java.util.Vector getIvyClientsByName(java.lang.String name)
name
- The name of the Ivy agent you're looking forpublic static java.lang.String getDomain(java.lang.String domainbus)
public void run()
run
in interface java.lang.Runnable
public java.lang.String domains(java.lang.String toparse)
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |