/**
* Part of a Ivy-level proxy
*
* @author Yannick Jestin
* @author http://www.tls.cena.fr/products/ivy/
*
* (c) CENA 1998-2004
*
* CHANGELOG:
* 1.2.14
* - switch from gnu regexp (deprecated) to the built in java regexp
* - add generic types to declarations
* 1.2.13:
* - adds support for RESyntaxException
*/
package fr.dgac.ivy ;
import java.lang.Thread;
import java.net.*;
import java.io.*;
import java.util.*;
import java.util.regex.*;
class Puppet {
// the mapping between Ghost regexp and local bus regexp numbers
Hashtable bound = new Hashtable(); // ghostID localID
Hashtableregexps = new Hashtable(); // ghostID textRegexp
String domain;
String appName;
ProxyClient pc;
String id;
boolean started;
PuppetIvy bus;
Puppet(ProxyClient pc,String id,String domain) {
this.domain=domain;
this.pc=pc;
this.id=id;
}
void sendGhost(String s) { pc.send("ForwardGhost id="+id+" buffer="+s); }
class ForwardMessenger implements IvyMessageListener {
String localId,ghostId;
public ForwardMessenger(String ghostId,String re) throws IvyException {
this.ghostId=ghostId;
this.localId = Integer.valueOf(bus.bindMsg(re,ForwardMessenger.this)).toString();
bound.put(ghostId,localId);
}
public void receive(IvyClient ic,String args[]) {
StringBuffer tosend = new StringBuffer(IvyClient.Msg);
tosend.append(" ");
tosend.append(ghostId);
tosend.append(IvyClient.StartArg);
for (int i=0;i