/** * the Ghost peers on the bus ( Proxy scheme ) * * @author Yannick Jestin * @author http://www.tls.cena.fr/products/ivy/ * * CHANGELOG: * 1.2.12 */ package fr.dgac.ivy ; import java.io.*; import java.net.*; import java.util.*; import org.apache.regexp.*; class Ghost extends IvyClient { private String id; // given to the Proxy by the Master private ProxyClient pc; Ghost(Ivy bus, Socket socket,int remotePort,boolean incoming,String id,ProxyClient pc) throws IOException { super(bus,socket,remotePort,incoming); this.id=id; this.pc=pc; System.out.println("new Ghost: "+id+" pc:"+pc); } // ProxyClient -> Ghost -> Ivy Bus protected synchronized void sendBuffer( String buffer ) throws IvyException { // System.out.println("out buffer: "+buffer+" for:"+pc+" id:"+id); super.sendBuffer(buffer); // and to all the agents on the Ghost bus ? I'm not sure } // Bus -> Ghost -> ProxyClient -> ProxyMaster -> other buses protected boolean newParseMsg(String s) throws IvyException { // I received a message from an agent on the bus System.out.println("in buffer to forward from "+id+": "+s); if (pc!=null) pc.forward(id,s); // forward to all the puppets return super.newParseMsg(s); // I'll take no action } }