|
|||||||||
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
|
protected java.lang.String |
appName
the name of the application on the bus |
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 |
protected boolean |
doProtectNewlines
|
static java.lang.String |
libVersion
the library version, useful for development purposes only, when java is invoked with -DIVY_DEBUG |
static int |
PROTOCOLMINIMUM
|
static int |
PROTOCOLVERSION
the protocol version number |
protected java.lang.String |
ready_message
|
protected fr.dgac.ivy.SelfIvyClient |
selfIvyClient
|
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 |
addBindListener(fr.dgac.ivy.IvyBindListener callback)
adds a bind listener to a bus |
int |
bindAsyncMsg(java.lang.String sregexp,
fr.dgac.ivy.IvyMessageListener callback)
Subscribes to a regular expression with asyncrhonous callback execution. |
int |
bindMsg(java.lang.String sregexp,
fr.dgac.ivy.IvyMessageListener callback)
Subscribes to a regular expression. |
int |
bindMsg(java.lang.String sregexp,
fr.dgac.ivy.IvyMessageListener callback,
boolean async)
Subscribes to a regular expression. |
protected void |
clientConnects(fr.dgac.ivy.IvyClient client)
|
protected void |
clientDisconnects(fr.dgac.ivy.IvyClient client)
|
protected void |
dieReceived(fr.dgac.ivy.IvyClient client,
int id,
java.lang.String message)
|
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 |
fr.dgac.ivy.IvyClient |
getSelfIvyClient()
returns our self IvyClient. |
protected int |
getSerial()
|
boolean |
isSendToSelf()
|
static void |
main(java.lang.String[] args)
|
fr.dgac.ivy.Ivy.Domain[] |
parseDomains(java.lang.String domainbus)
|
void |
protectNewlines(boolean b)
Toggles the encoding/decoding of messages to prevent bugs related to the presence of a "\n" |
protected void |
regexpDeleted(fr.dgac.ivy.IvyClient client,
int id,
java.lang.String sregexp)
|
protected void |
regexpReceived(fr.dgac.ivy.IvyClient client,
int id,
java.lang.String sregexp)
|
void |
removeApplicationListener(int id)
removes an application listener |
void |
removeBindListener(int id)
removes a bind 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 |
fr.dgac.ivy.IvyClient |
waitForClient(java.lang.String name,
int timeout)
Waits for an other IvyClient to join the bus |
fr.dgac.ivy.IvyClient |
waitForMsg(java.lang.String regexp,
int timeout)
Waits for a message to be received |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.lang.String appName
public static final int PROTOCOLVERSION
public static final int PROTOCOLMINIMUM
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.lang.String ready_message
protected boolean doProtectNewlines
protected fr.dgac.ivy.SelfIvyClient selfIvyClient
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 fr.dgac.ivy.IvyClient waitForMsg(java.lang.String regexp, int timeout) throws IvyException
regexp
- the message we're waiting for to continue the main thread.timeout
- in millisecond, 0 if infinite
IvyException
public fr.dgac.ivy.IvyClient waitForClient(java.lang.String name, int timeout) throws IvyException
name
- the name of the client we're waiting for to continue the main thread.timeout
- in millisecond, 0 if infinite
IvyException
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)
public boolean isSendToSelf()
public fr.dgac.ivy.IvyClient getSelfIvyClient()
public void protectNewlines(boolean b)
public int sendMsg(java.lang.String message) throws IvyException
message
- A String which will be compared to the regular
expressions of the different clients
IvyException
public int bindMsg(java.lang.String sregexp, fr.dgac.ivy.IvyMessageListener callback) throws IvyException
Example:
the Ivy agent A performs
b.bindMsg("^Hello (*)",cb);
b2.sendMsg("Hello world");
callback
- any objects implementing the IvyMessageListener
interface, on the AWT/Swing framework
IvyException
public int bindAsyncMsg(java.lang.String sregexp, fr.dgac.ivy.IvyMessageListener callback) throws IvyException
callback
- any objects implementing the IvyMessageListener
interface, on the AWT/Swing framework
IvyException
public int bindMsg(java.lang.String sregexp, fr.dgac.ivy.IvyMessageListener callback, boolean async) throws IvyException
Example:
the Ivy agent A performs
b.bindMsg("^Hello (*)",cb);
b2.sendMsg("Hello world");
callback
- any objects implementing the IvyMessageListener
interface, on the AWT/Swing frameworkasync
- if true, each callback will be run in a separate thread,
default is false
IvyException
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 addBindListener(fr.dgac.ivy.IvyBindListener callback)
callback
- is an object implementing the IvyBindListener interface
public void removeBindListener(int id) throws IvyException
id
- the id of the bind listener to remove
IvyException
public int addApplicationListener(fr.dgac.ivy.IvyApplicationListener callback)
callback
- is an object implementing the IvyApplicationListener
interface
public void removeApplicationListener(int id) throws IvyException
id
- the id of the application listener to remove
IvyException
protected void clientConnects(fr.dgac.ivy.IvyClient client)
protected void clientDisconnects(fr.dgac.ivy.IvyClient client)
protected void regexpReceived(fr.dgac.ivy.IvyClient client, int id, java.lang.String sregexp)
protected void regexpDeleted(fr.dgac.ivy.IvyClient client, int id, java.lang.String sregexp)
protected void dieReceived(fr.dgac.ivy.IvyClient client, int id, java.lang.String message)
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
protected int getSerial()
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 |